Linux Perf
perf_regs.c
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-2.0
2
#include <errno.h>
3
#include "
perf_regs.h
"
4
#include "
event.h
"
5
6
const
struct
sample_reg
__weak
sample_reg_masks
[] = {
7
SMPL_REG_END
8
};
9
10
int
__weak
arch_sdt_arg_parse_op
(
char
*old_op __maybe_unused,
11
char
**new_op __maybe_unused)
12
{
13
return
SDT_ARG_SKIP
;
14
}
15
16
#ifdef HAVE_PERF_REGS_SUPPORT
17
int
perf_reg_value
(u64 *valp,
struct
regs_dump
*regs,
int
id
)
18
{
19
int
i, idx = 0;
20
u64
mask
= regs->
mask
;
21
22
if
(regs->
cache_mask
& (1ULL <<
id
))
23
goto
out;
24
25
if
(!(mask & (1ULL <<
id
)))
26
return
-EINVAL;
27
28
for
(i = 0; i < id; i++) {
29
if
(mask & (1ULL << i))
30
idx++;
31
}
32
33
regs->
cache_mask
|= (1ULL << id);
34
regs->
cache_regs
[id] = regs->
regs
[idx];
35
36
out:
37
*valp = regs->
cache_regs
[id];
38
return
0;
39
}
40
#endif
sample_reg_masks
const struct sample_reg sample_reg_masks[]
Definition:
perf_regs.c:11
sample_reg::mask
uint64_t mask
Definition:
perf_regs.h:12
arch_sdt_arg_parse_op
int arch_sdt_arg_parse_op(char *old_op, char **new_op)
Definition:
perf_regs.c:110
perf_reg_value
static int perf_reg_value(u64 *valp __maybe_unused, struct regs_dump *regs __maybe_unused, int id __maybe_unused)
Definition:
perf_regs.h:40
regs_dump::mask
u64 mask
Definition:
event.h:104
regs_dump
Definition:
event.h:102
SDT_ARG_SKIP
Definition:
perf_regs.h:21
regs_dump::cache_regs
u64 cache_regs[PERF_REGS_MAX]
Definition:
event.h:108
sample_reg
Definition:
perf_regs.h:10
perf_regs.h
event.h
regs_dump::regs
u64 * regs
Definition:
event.h:105
regs_dump::cache_mask
u64 cache_mask
Definition:
event.h:109
SMPL_REG_END
#define SMPL_REG_END
Definition:
perf_regs.h:15
util
perf_regs.c
Generated by
1.8.13