union perf_event *event_sw;
struct perf_sample sample_sw;
struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
- u32 pid = evsel__intval(evsel, sample, "pid");
+ u32 pid = perf_sample__intval(sample, "pid");
int ret;
list_for_each_entry(ent, &inject->samples, node) {
static int evsel__process_alloc_event(struct evsel *evsel, struct perf_sample *sample)
{
- unsigned long ptr = evsel__intval(evsel, sample, "ptr"),
- call_site = evsel__intval(evsel, sample, "call_site");
- int bytes_req = evsel__intval(evsel, sample, "bytes_req"),
- bytes_alloc = evsel__intval(evsel, sample, "bytes_alloc");
+ unsigned long ptr = perf_sample__intval(sample, "ptr"),
+ call_site = perf_sample__intval(sample, "call_site");
+ int bytes_req = perf_sample__intval(sample, "bytes_req"),
+ bytes_alloc = perf_sample__intval(sample, "bytes_alloc");
if (insert_alloc_stat(call_site, ptr, bytes_req, bytes_alloc, sample->cpu) ||
insert_caller_stat(call_site, bytes_req, bytes_alloc))
int node1, node2;
node1 = cpu__get_node((struct perf_cpu){.cpu = sample->cpu});
- node2 = evsel__intval(evsel, sample, "node");
+ node2 = perf_sample__intval(sample, "node");
/*
* If the field "node" is NUMA_NO_NODE (-1), we don't take it
return NULL;
}
-static int evsel__process_free_event(struct evsel *evsel, struct perf_sample *sample)
+static int evsel__process_free_event(struct evsel *evsel __maybe_unused, struct perf_sample *sample)
{
- unsigned long ptr = evsel__intval(evsel, sample, "ptr");
+ unsigned long ptr = perf_sample__intval(sample, "ptr");
struct alloc_stat *s_alloc, *s_caller;
s_alloc = search_alloc_stat(ptr, 0, &root_alloc_stat, ptr_cmp);
static int evsel__process_page_alloc_event(struct evsel *evsel, struct perf_sample *sample)
{
u64 page;
- unsigned int order = evsel__intval(evsel, sample, "order");
- unsigned int gfp_flags = evsel__intval(evsel, sample, "gfp_flags");
- unsigned int migrate_type = evsel__intval(evsel, sample,
- "migratetype");
+ unsigned int order = perf_sample__intval(sample, "order");
+ unsigned int gfp_flags = perf_sample__intval(sample, "gfp_flags");
+ unsigned int migrate_type = perf_sample__intval(sample, "migratetype");
u64 bytes = kmem_page_size << order;
u64 callsite;
struct page_stat *pstat;
};
if (use_pfn)
- page = evsel__intval(evsel, sample, "pfn");
+ page = perf_sample__intval(sample, "pfn");
else
- page = evsel__intval(evsel, sample, "page");
+ page = perf_sample__intval(sample, "page");
nr_page_allocs++;
total_page_alloc_bytes += bytes;
return 0;
}
-static int evsel__process_page_free_event(struct evsel *evsel, struct perf_sample *sample)
+static int evsel__process_page_free_event(struct evsel *evsel __maybe_unused,
+ struct perf_sample *sample)
{
u64 page;
- unsigned int order = evsel__intval(evsel, sample, "order");
+ unsigned int order = perf_sample__intval(sample, "order");
u64 bytes = kmem_page_size << order;
struct page_stat *pstat;
struct page_stat this = {
};
if (use_pfn)
- page = evsel__intval(evsel, sample, "pfn");
+ page = perf_sample__intval(sample, "pfn");
else
- page = evsel__intval(evsel, sample, "page");
+ page = perf_sample__intval(sample, "page");
nr_page_frees++;
total_page_free_bytes += bytes;
return NULL;
}
- vcpu_record->vcpu_id = evsel__intval(sample->evsel, sample, vcpu_id_str(e_machine));
+ vcpu_record->vcpu_id = perf_sample__intval(sample, vcpu_id_str(e_machine));
thread__set_priv(thread, vcpu_record);
}
struct kwork_class *class,
struct kwork_work *work,
enum kwork_trace_type src_type __maybe_unused,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine __maybe_unused)
{
work->cpu = sample->cpu;
if (kwork->report == KWORK_REPORT_TOP) {
- work->id = evsel__intval_common(evsel, sample, "common_pid");
+ work->id = perf_sample__intval_common(sample, "common_pid");
work->name = NULL;
} else {
- work->id = evsel__intval(evsel, sample, "irq");
- work->name = evsel__strval(evsel, sample, "name");
+ work->id = perf_sample__intval(sample, "irq");
+ work->name = perf_sample__strval(sample, "name");
}
}
work->cpu = sample->cpu;
if (kwork->report == KWORK_REPORT_TOP) {
- work->id = evsel__intval_common(evsel, sample, "common_pid");
+ work->id = perf_sample__intval_common(sample, "common_pid");
work->name = NULL;
} else {
- num = evsel__intval(evsel, sample, "vec");
+ num = perf_sample__intval(sample, "vec");
work->id = num;
work->name = evsel__softirq_name(evsel, num);
}
struct kwork_class *class,
struct kwork_work *work,
enum kwork_trace_type src_type __maybe_unused,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine)
{
char *modp = NULL;
- unsigned long long function_addr = evsel__intval(evsel,
- sample, "function");
+ unsigned long long function_addr = perf_sample__intval(sample, "function");
work->class = class;
work->cpu = sample->cpu;
- work->id = evsel__intval(evsel, sample, "work");
+ work->id = perf_sample__intval(sample, "work");
work->name = function_addr == 0 ? NULL :
machine__resolve_kernel_addr(machine, &function_addr, &modp);
}
struct kwork_class *class,
struct kwork_work *work,
enum kwork_trace_type src_type,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine __maybe_unused)
{
work->cpu = sample->cpu;
if (src_type == KWORK_TRACE_EXIT) {
- work->id = evsel__intval(evsel, sample, "prev_pid");
- work->name = strdup(evsel__strval(evsel, sample, "prev_comm"));
+ work->id = perf_sample__intval(sample, "prev_pid");
+ work->name = strdup(perf_sample__strval(sample, "prev_comm"));
} else if (src_type == KWORK_TRACE_ENTRY) {
- work->id = evsel__intval(evsel, sample, "next_pid");
- work->name = strdup(evsel__strval(evsel, sample, "next_comm"));
+ work->id = perf_sample__intval(sample, "next_pid");
+ work->name = strdup(perf_sample__strval(sample, "next_comm"));
}
}
return get_key_by_aggr_mode_simple(key, addr, sample->tid);
}
-static int report_lock_acquire_event(struct evsel *evsel,
+static int report_lock_acquire_event(struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
struct lock_seq_stat *seq;
- const char *name = evsel__strval(evsel, sample, "name");
- u64 addr = evsel__intval(evsel, sample, "lockdep_addr");
- int flag = evsel__intval(evsel, sample, "flags");
+ const char *name = perf_sample__strval(sample, "name");
+ u64 addr = perf_sample__intval(sample, "lockdep_addr");
+ int flag = perf_sample__intval(sample, "flags");
u64 key;
int ret;
return 0;
}
-static int report_lock_acquired_event(struct evsel *evsel,
+static int report_lock_acquired_event(struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
struct lock_seq_stat *seq;
u64 contended_term;
- const char *name = evsel__strval(evsel, sample, "name");
- u64 addr = evsel__intval(evsel, sample, "lockdep_addr");
+ const char *name = perf_sample__strval(sample, "name");
+ u64 addr = perf_sample__intval(sample, "lockdep_addr");
u64 key;
int ret;
return 0;
}
-static int report_lock_contended_event(struct evsel *evsel,
+static int report_lock_contended_event(struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
struct lock_seq_stat *seq;
- const char *name = evsel__strval(evsel, sample, "name");
- u64 addr = evsel__intval(evsel, sample, "lockdep_addr");
+ const char *name = perf_sample__strval(sample, "name");
+ u64 addr = perf_sample__intval(sample, "lockdep_addr");
u64 key;
int ret;
return 0;
}
-static int report_lock_release_event(struct evsel *evsel,
+static int report_lock_release_event(struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
struct lock_seq_stat *seq;
- const char *name = evsel__strval(evsel, sample, "name");
- u64 addr = evsel__intval(evsel, sample, "lockdep_addr");
+ const char *name = perf_sample__strval(sample, "name");
+ u64 addr = perf_sample__intval(sample, "lockdep_addr");
u64 key;
int ret;
struct lock_stat *ls;
struct thread_stat *ts;
struct lock_seq_stat *seq;
- u64 addr = evsel__intval(evsel, sample, "lock_addr");
- unsigned int flags = evsel__intval(evsel, sample, "flags");
+ u64 addr = perf_sample__intval(sample, "lock_addr");
+ unsigned int flags = perf_sample__intval(sample, "flags");
u64 key;
int i, ret;
static bool kmap_loaded;
struct thread_stat *ts;
struct lock_seq_stat *seq;
u64 contended_term;
- u64 addr = evsel__intval(evsel, sample, "lock_addr");
+ u64 addr = perf_sample__intval(sample, "lock_addr");
u64 key;
int ret;
struct evsel *evsel, struct perf_sample *sample,
struct machine *machine __maybe_unused)
{
- const char *comm = evsel__strval(evsel, sample, "comm");
- const u32 pid = evsel__intval(evsel, sample, "pid");
+ const char *comm = perf_sample__strval(sample, "comm");
+ const u32 pid = perf_sample__intval(sample, "pid");
struct task_desc *waker, *wakee;
if (verbose > 0) {
struct perf_sample *sample,
struct machine *machine __maybe_unused)
{
- const char *prev_comm = evsel__strval(evsel, sample, "prev_comm"),
- *next_comm = evsel__strval(evsel, sample, "next_comm");
- const u32 prev_pid = evsel__intval(evsel, sample, "prev_pid"),
- next_pid = evsel__intval(evsel, sample, "next_pid");
+ const char *prev_comm = perf_sample__strval(sample, "prev_comm"),
+ *next_comm = perf_sample__strval(sample, "next_comm");
+ const u32 prev_pid = perf_sample__intval(sample, "prev_pid"),
+ next_pid = perf_sample__intval(sample, "next_pid");
struct task_desc *prev, __maybe_unused *next;
u64 timestamp0, timestamp = sample->time;
int cpu = sample->cpu;
}
static int latency_switch_event(struct perf_sched *sched,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine)
{
- const u32 prev_pid = evsel__intval(evsel, sample, "prev_pid"),
- next_pid = evsel__intval(evsel, sample, "next_pid");
- const char prev_state = evsel__taskstate(evsel, sample, "prev_state");
+ const u32 prev_pid = perf_sample__intval(sample, "prev_pid"),
+ next_pid = perf_sample__intval(sample, "next_pid");
+ const char prev_state = perf_sample__taskstate(sample, "prev_state");
struct work_atoms *out_events, *in_events;
struct thread *sched_out, *sched_in;
u64 timestamp0, timestamp = sample->time;
}
static int latency_runtime_event(struct perf_sched *sched,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine)
{
- const u32 pid = evsel__intval(evsel, sample, "pid");
- const u64 runtime = evsel__intval(evsel, sample, "runtime");
+ const u32 pid = perf_sample__intval(sample, "pid");
+ const u64 runtime = perf_sample__intval(sample, "runtime");
struct thread *thread = machine__findnew_thread(machine, -1, pid);
struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid);
u64 timestamp = sample->time;
}
static int latency_wakeup_event(struct perf_sched *sched,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine)
{
- const u32 pid = evsel__intval(evsel, sample, "pid");
+ const u32 pid = perf_sample__intval(sample, "pid");
struct work_atoms *atoms;
struct work_atom *atom;
struct thread *wakee;
}
static int latency_migrate_task_event(struct perf_sched *sched,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
struct machine *machine)
{
- const u32 pid = evsel__intval(evsel, sample, "pid");
+ const u32 pid = perf_sample__intval(sample, "pid");
u64 timestamp = sample->time;
struct work_atoms *atoms;
struct work_atom *atom;
}
}
-static int map_switch_event(struct perf_sched *sched, struct evsel *evsel,
+static int map_switch_event(struct perf_sched *sched, struct evsel *evsel __maybe_unused,
struct perf_sample *sample, struct machine *machine)
{
- const u32 next_pid = evsel__intval(evsel, sample, "next_pid");
- const u32 prev_pid = evsel__intval(evsel, sample, "prev_pid");
+ const u32 next_pid = perf_sample__intval(sample, "next_pid");
+ const u32 prev_pid = perf_sample__intval(sample, "prev_pid");
struct thread *sched_in, *sched_out;
struct thread_runtime *tr;
int new_shortname;
{
struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
int this_cpu = sample->cpu, err = 0;
- u32 prev_pid = evsel__intval(evsel, sample, "prev_pid"),
- next_pid = evsel__intval(evsel, sample, "next_pid");
+ u32 prev_pid = perf_sample__intval(sample, "prev_pid"),
+ next_pid = perf_sample__intval(sample, "next_pid");
if (sched->curr_pid[this_cpu] != (u32)-1) {
/*
/* prio field format: xxx or xxx->yyy */
#define MAX_PRIO_STR_LEN 8
-static char *timehist_get_priostr(struct evsel *evsel,
- struct thread *thread,
+static char *timehist_get_priostr(struct thread *thread,
struct perf_sample *sample)
{
static char prio_str[16];
- int prev_prio = (int)evsel__intval(evsel, sample, "prev_prio");
+ int prev_prio = (int)perf_sample__intval(sample, "prev_prio");
struct thread_runtime *tr = thread__priv(thread);
if (tr->prio != prev_prio && tr->prio != -1)
}
static void timehist_print_sample(struct perf_sched *sched,
- struct evsel *evsel,
struct perf_sample *sample,
struct addr_location *al,
struct thread *thread,
u64 t, const char state)
{
struct thread_runtime *tr = thread__priv(thread);
- const char *next_comm = evsel__strval(evsel, sample, "next_comm");
- const u32 next_pid = evsel__intval(evsel, sample, "next_pid");
+ const char *next_comm = perf_sample__strval(sample, "next_comm");
+ const u32 next_pid = perf_sample__intval(sample, "next_pid");
u32 max_cpus = sched->max_cpu.cpu + 1;
char tstr[64];
char nstr[30];
}
if (!thread__comm_set(thread)) {
- const char *prev_comm = evsel__strval(evsel, sample, "prev_comm");
- thread__set_comm(thread, prev_comm, sample->time);
+ const char *prev_comm = perf_sample__strval(sample, "prev_comm");
+
+ thread__set_comm(thread, prev_comm, sample->time);
}
printf(" %-*s ", comm_width, timehist_get_commstr(thread));
if (sched->show_prio)
- printf(" %-*s ", MAX_PRIO_STR_LEN, timehist_get_priostr(evsel, thread, sample));
+ printf(" %-*s ", MAX_PRIO_STR_LEN, timehist_get_priostr(thread, sample));
wait_time = tr->dt_sleep + tr->dt_iowait + tr->dt_preempt;
print_sched_time(wait_time, 6);
{
/* pid 0 == swapper == idle task */
if (evsel__name_is(evsel, "sched:sched_switch"))
- return evsel__intval(evsel, sample, "prev_pid") == 0;
+ return perf_sample__intval(sample, "prev_pid") == 0;
return sample->pid == 0;
}
itr->last_thread = thread__get(thread);
/* copy task callchain when entering to idle */
- if (evsel__intval(evsel, sample, "next_pid") == 0)
+ if (perf_sample__intval(sample, "next_pid") == 0)
save_idle_callchain(sched, itr, sample);
}
}
if (tr && tr->prio != -1)
prio = tr->prio;
else if (evsel__name_is(evsel, "sched:sched_switch"))
- prio = evsel__intval(evsel, sample, "prev_prio");
+ prio = perf_sample__intval(sample, "prev_prio");
if (prio != -1 && !test_bit(prio, sched->prio_bitmap)) {
rc = true;
if (sched->idle_hist) {
if (!evsel__name_is(evsel, "sched:sched_switch"))
rc = true;
- else if (evsel__intval(evsel, sample, "prev_pid") != 0 &&
- evsel__intval(evsel, sample, "next_pid") != 0)
+ else if (perf_sample__intval(sample, "prev_pid") != 0 &&
+ perf_sample__intval(sample, "next_pid") != 0)
rc = true;
}
struct thread *thread;
struct thread_runtime *tr = NULL;
/* want pid of awakened task not pid in sample */
- const u32 pid = evsel__intval(evsel, sample, "pid");
+ const u32 pid = perf_sample__intval(sample, "pid");
thread = machine__findnew_thread(machine, 0, pid);
if (thread == NULL)
return;
max_cpus = sched->max_cpu.cpu + 1;
- ocpu = evsel__intval(evsel, sample, "orig_cpu");
- dcpu = evsel__intval(evsel, sample, "dest_cpu");
+ ocpu = perf_sample__intval(sample, "orig_cpu");
+ dcpu = perf_sample__intval(sample, "dest_cpu");
thread = machine__findnew_thread(machine, sample->pid, sample->tid);
if (thread == NULL)
struct thread *thread;
struct thread_runtime *tr = NULL;
/* want pid of migrated task not pid in sample */
- const u32 pid = evsel__intval(evsel, sample, "pid");
+ const u32 pid = perf_sample__intval(sample, "pid");
thread = machine__findnew_thread(machine, 0, pid);
if (thread == NULL)
return 0;
}
-static void timehist_update_task_prio(struct evsel *evsel,
- struct perf_sample *sample,
+static void timehist_update_task_prio(struct perf_sample *sample,
struct machine *machine)
{
struct thread *thread;
struct thread_runtime *tr = NULL;
- const u32 next_pid = evsel__intval(evsel, sample, "next_pid");
- const u32 next_prio = evsel__intval(evsel, sample, "next_prio");
+ const u32 next_pid = perf_sample__intval(sample, "next_pid");
+ const u32 next_prio = perf_sample__intval(sample, "next_prio");
if (next_pid == 0)
thread = get_idle_thread(sample->cpu);
struct thread_runtime *tr = NULL;
u64 tprev, t = sample->time;
int rc = 0;
- const char state = evsel__taskstate(evsel, sample, "prev_state");
+ const char state = perf_sample__taskstate(sample, "prev_state");
addr_location__init(&al);
if (machine__resolve(machine, &al, sample) < 0) {
}
if (sched->show_prio || sched->prio_str)
- timehist_update_task_prio(evsel, sample, machine);
+ timehist_update_task_prio(sample, machine);
thread = timehist_get_thread(sched, sample, machine, evsel);
if (thread == NULL) {
}
if (!sched->summary_only)
- timehist_print_sample(sched, evsel, sample, &al, thread, t, state);
+ timehist_print_sample(sched, sample, &al, thread, t, state);
}
out:
static int
process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
- u32 state = evsel__intval(evsel, sample, "state");
- u32 cpu_id = evsel__intval(evsel, sample, "cpu_id");
+ u32 state = perf_sample__intval(sample, "state");
+ u32 cpu_id = perf_sample__intval(sample, "cpu_id");
if (state == (u32)PWR_EVENT_EXIT)
c_state_end(tchart, cpu_id, sample->time);
static int
process_sample_cpu_frequency(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
- u32 state = evsel__intval(evsel, sample, "state");
- u32 cpu_id = evsel__intval(evsel, sample, "cpu_id");
+ u32 state = perf_sample__intval(sample, "state");
+ u32 cpu_id = perf_sample__intval(sample, "cpu_id");
p_state_change(tchart, cpu_id, sample->time, state);
return 0;
static int
process_sample_sched_wakeup(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace)
{
- u8 flags = evsel__intval(evsel, sample, "common_flags");
- int waker = evsel__intval(evsel, sample, "common_pid");
- int wakee = evsel__intval(evsel, sample, "pid");
+ u8 flags = perf_sample__intval(sample, "common_flags");
+ int waker = perf_sample__intval(sample, "common_pid");
+ int wakee = perf_sample__intval(sample, "pid");
sched_wakeup(tchart, sample->cpu, sample->time, waker, wakee, flags, backtrace);
return 0;
static int
process_sample_sched_switch(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace)
{
- int prev_pid = evsel__intval(evsel, sample, "prev_pid");
- int next_pid = evsel__intval(evsel, sample, "next_pid");
- u64 prev_state = evsel__intval(evsel, sample, "prev_state");
+ int prev_pid = perf_sample__intval(sample, "prev_pid");
+ int next_pid = perf_sample__intval(sample, "next_pid");
+ u64 prev_state = perf_sample__intval(sample, "prev_state");
sched_switch(tchart, sample->cpu, sample->time, prev_pid, next_pid,
prev_state, backtrace);
#ifdef SUPPORT_OLD_POWER_EVENTS
static int
process_sample_power_start(struct timechart *tchart __maybe_unused,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
- u64 cpu_id = evsel__intval(evsel, sample, "cpu_id");
- u64 value = evsel__intval(evsel, sample, "value");
+ u64 cpu_id = perf_sample__intval(sample, "cpu_id");
+ u64 value = perf_sample__intval(sample, "value");
c_state_start(cpu_id, sample->time, value);
return 0;
static int
process_sample_power_frequency(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
- u64 cpu_id = evsel__intval(evsel, sample, "cpu_id");
- u64 value = evsel__intval(evsel, sample, "value");
+ u64 cpu_id = perf_sample__intval(sample, "cpu_id");
+ u64 value = perf_sample__intval(sample, "value");
p_state_change(tchart, cpu_id, sample->time, value);
return 0;
static int
process_enter_read(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long fd = evsel__intval(evsel, sample, "fd");
+ long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_READ,
sample->time, fd);
}
static int
process_exit_read(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long ret = evsel__intval(evsel, sample, "ret");
+ long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_READ,
sample->time, ret);
}
static int
process_enter_write(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long fd = evsel__intval(evsel, sample, "fd");
+ long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_WRITE,
sample->time, fd);
}
static int
process_exit_write(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long ret = evsel__intval(evsel, sample, "ret");
+ long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_WRITE,
sample->time, ret);
}
static int
process_enter_sync(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long fd = evsel__intval(evsel, sample, "fd");
+ long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_SYNC,
sample->time, fd);
}
static int
process_exit_sync(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long ret = evsel__intval(evsel, sample, "ret");
+ long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_SYNC,
sample->time, ret);
}
static int
process_enter_tx(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long fd = evsel__intval(evsel, sample, "fd");
+ long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_TX,
sample->time, fd);
}
static int
process_exit_tx(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long ret = evsel__intval(evsel, sample, "ret");
+ long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_TX,
sample->time, ret);
}
static int
process_enter_rx(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long fd = evsel__intval(evsel, sample, "fd");
+ long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_RX,
sample->time, fd);
}
static int
process_exit_rx(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long ret = evsel__intval(evsel, sample, "ret");
+ long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_RX,
sample->time, ret);
}
static int
process_enter_poll(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long fd = evsel__intval(evsel, sample, "fd");
+ long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_POLL,
sample->time, fd);
}
static int
process_exit_poll(struct timechart *tchart,
- struct evsel *evsel,
+ struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
{
- long ret = evsel__intval(evsel, sample, "ret");
+ long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_POLL,
sample->time, ret);
}
return err;
}
-static int trace__vfs_getname(struct trace *trace, struct evsel *evsel,
+static int trace__vfs_getname(struct trace *trace, struct evsel *evsel __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_sample *sample)
{
size_t filename_len, entry_str_len, to_move;
ssize_t remaining_space;
char *pos;
- const char *filename = evsel__rawptr(evsel, sample, "pathname");
+ const char *filename = perf_sample__strval(sample, "pathname");
if (!thread)
goto out;
union perf_event *event __maybe_unused,
struct perf_sample *sample)
{
- u64 runtime = evsel__intval(evsel, sample, "runtime");
+ u64 runtime = perf_sample__intval(sample, "runtime");
double runtime_ms = (double)runtime / NSEC_PER_MSEC;
struct thread *thread = machine__findnew_thread(trace->host,
sample->pid,
out_dump:
fprintf(trace->output, "%s: comm=%s,pid=%u,runtime=%" PRIu64 ",vruntime=%" PRIu64 ")\n",
evsel->name,
- evsel__strval(evsel, sample, "comm"),
- (pid_t)evsel__intval(evsel, sample, "pid"),
+ perf_sample__strval(sample, "comm"),
+ (pid_t)perf_sample__intval(sample, "pid"),
runtime,
- evsel__intval(evsel, sample, "vruntime"));
+ perf_sample__intval(sample, "vruntime"));
goto out_put;
}
goto out_delete_evlist;
}
- tp_flags = evsel__intval(evsel, &sample, "flags");
+ tp_flags = perf_sample__intval(&sample, "flags");
perf_sample__exit(&sample);
/* C library wrapper may set additional flags,
access mode must be unchanged */
evsel = evlist__id2evsel(evlist, sample.id);
if (evsel == switch_tracking->switch_evsel) {
- next_tid = evsel__intval(evsel, &sample, "next_pid");
- prev_tid = evsel__intval(evsel, &sample, "prev_pid");
+ next_tid = perf_sample__intval(&sample, "next_pid");
+ prev_tid = perf_sample__intval(&sample, "prev_pid");
cpu = sample.cpu;
pr_debug3("sched_switch: cpu: %d prev_tid %d next_tid %d\n",
cpu, prev_tid, next_tid);
return tp_format ? tep_find_common_field(tp_format, name) : NULL;
}
-void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const char *name)
+void *perf_sample__rawptr(struct perf_sample *sample, const char *name)
{
- struct tep_format_field *field = evsel__field(evsel, name);
+ struct tep_format_field *field = evsel__field(sample->evsel, name);
int offset;
if (!field)
return 0;
}
-u64 evsel__intval(struct evsel *evsel, struct perf_sample *sample, const char *name)
+u64 perf_sample__intval(struct perf_sample *sample, const char *name)
{
- struct tep_format_field *field = evsel__field(evsel, name);
+ struct tep_format_field *field = evsel__field(sample->evsel, name);
- return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
+ return field ? format_field__intval(field, sample, sample->evsel->needs_swap) : 0;
}
-u64 evsel__intval_common(struct evsel *evsel, struct perf_sample *sample, const char *name)
+u64 perf_sample__intval_common(struct perf_sample *sample, const char *name)
{
- struct tep_format_field *field = evsel__common_field(evsel, name);
+ struct tep_format_field *field = evsel__common_field(sample->evsel, name);
- return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
+ return field ? format_field__intval(field, sample, sample->evsel->needs_swap) : 0;
}
-char evsel__taskstate(struct evsel *evsel, struct perf_sample *sample, const char *name)
+char perf_sample__taskstate(struct perf_sample *sample, const char *name)
{
static struct tep_format_field *prev_state_field;
static const char *states;
unsigned int bit;
char state = '?'; /* '?' denotes unknown task state */
- field = evsel__field(evsel, name);
+ field = evsel__field(sample->evsel, name);
if (!field)
return state;
*
* We can change this if we have a good reason in the future.
*/
- val = evsel__intval(evsel, sample, name);
+ val = perf_sample__intval(sample, name);
bit = val ? ffs(val) : 0;
state = (!bit || bit > strlen(states)) ? 'R' : states[bit-1];
return state;
struct perf_sample;
#ifdef HAVE_LIBTRACEEVENT
-void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const char *name);
-u64 evsel__intval(struct evsel *evsel, struct perf_sample *sample, const char *name);
-u64 evsel__intval_common(struct evsel *evsel, struct perf_sample *sample, const char *name);
-char evsel__taskstate(struct evsel *evsel, struct perf_sample *sample, const char *name);
+void *perf_sample__rawptr(struct perf_sample *sample, const char *name);
+u64 perf_sample__intval(struct perf_sample *sample, const char *name);
+u64 perf_sample__intval_common(struct perf_sample *sample, const char *name);
+char perf_sample__taskstate(struct perf_sample *sample, const char *name);
-static inline char *evsel__strval(struct evsel *evsel, struct perf_sample *sample, const char *name)
+static inline char *perf_sample__strval(struct perf_sample *sample, const char *name)
{
- return evsel__rawptr(evsel, sample, name);
+ return perf_sample__rawptr(sample, name);
}
#endif
if (evsel != pt->switch_evsel)
return 0;
- tid = evsel__intval(evsel, sample, "next_pid");
+ tid = perf_sample__intval(sample, "next_pid");
cpu = sample->cpu;
intel_pt_log("sched_switch: cpu %d tid %d time %"PRIu64" tsc %#"PRIx64"\n",
static void event_get_key(struct perf_sample *sample,
struct event_key *key)
{
- struct evsel *evsel = sample->evsel;
-
key->info = 0;
- key->key = evsel__intval(evsel, sample, kvm_exit_reason(EM_AARCH64));
+ key->key = perf_sample__intval(sample, kvm_exit_reason(EM_AARCH64));
key->exit_reasons = arm64_exit_reasons;
/*
* properly decode event's est_ec.
*/
if (key->key == ARM_EXCEPTION_TRAP) {
- key->key = evsel__intval(evsel, sample, kvm_trap_exit_reason);
+ key->key = perf_sample__intval(sample, kvm_trap_exit_reason);
key->exit_reasons = arm64_trap_exit_reasons;
}
}
unsigned int insn;
key->key = LOONGARCH_EXCEPTION_OTHERS;
- insn = evsel__intval(sample->evsel, sample, "inst_word");
+ insn = perf_sample__intval(sample, "inst_word");
switch (insn >> 24) {
case 0:
struct event_key *key)
{
key->info = 0;
- key->key = evsel__intval(sample->evsel, sample, "req");
+ key->key = perf_sample__intval(sample, "req");
}
static const char *get_hcall_exit_reason(u64 exit_code)
int xlen = 64; // TODO: 32-bit support.
key->info = 0;
- key->key = evsel__intval(sample->evsel, sample,
- kvm_exit_reason(EM_RISCV)) & ~CAUSE_IRQ_FLAG(xlen);
+ key->key = perf_sample__intval(sample, kvm_exit_reason(EM_RISCV)) & ~CAUSE_IRQ_FLAG(xlen);
key->exit_reasons = riscv_exit_reasons;
}
{
u64 insn;
- insn = evsel__intval(sample->evsel, sample, "instruction");
+ insn = perf_sample__intval(sample, "instruction");
key->key = icpt_insn_decoder(insn);
key->exit_reasons = sie_icpt_insn_codes;
}
static void event_sigp_get_key(struct perf_sample *sample,
struct event_key *key)
{
- key->key = evsel__intval(sample->evsel, sample, "order_code");
+ key->key = perf_sample__intval(sample, "order_code");
key->exit_reasons = sie_sigp_order_codes;
}
static void event_diag_get_key(struct perf_sample *sample,
struct event_key *key)
{
- key->key = evsel__intval(sample->evsel, sample, "code");
+ key->key = perf_sample__intval(sample, "code");
key->exit_reasons = sie_diagnose_codes;
}
static void event_icpt_prog_get_key(struct perf_sample *sample,
struct event_key *key)
{
- key->key = evsel__intval(sample->evsel, sample, "code");
+ key->key = perf_sample__intval(sample, "code");
key->exit_reasons = sie_icpt_prog_codes;
}
static void mmio_event_get_key(struct perf_sample *sample,
struct event_key *key)
{
- key->key = evsel__intval(sample->evsel, sample, "gpa");
- key->info = evsel__intval(sample->evsel, sample, "type");
+ key->key = perf_sample__intval(sample, "gpa");
+ key->info = perf_sample__intval(sample, "type");
}
#define KVM_TRACE_MMIO_READ_UNSATISFIED 0
/* MMIO write begin event in kernel. */
if (evsel__name_is(sample->evsel, "kvm:kvm_mmio") &&
- evsel__intval(sample->evsel, sample, "type") == KVM_TRACE_MMIO_WRITE) {
+ perf_sample__intval(sample, "type") == KVM_TRACE_MMIO_WRITE) {
mmio_event_get_key(sample, key);
return true;
}
/* MMIO read end event in kernel.*/
if (evsel__name_is(sample->evsel, "kvm:kvm_mmio") &&
- evsel__intval(sample->evsel, sample, "type") == KVM_TRACE_MMIO_READ) {
+ perf_sample__intval(sample, "type") == KVM_TRACE_MMIO_READ) {
mmio_event_get_key(sample, key);
return true;
}
static void ioport_event_get_key(struct perf_sample *sample,
struct event_key *key)
{
- key->key = evsel__intval(sample->evsel, sample, "port");
- key->info = evsel__intval(sample->evsel, sample, "rw");
+ key->key = perf_sample__intval(sample, "port");
+ key->info = perf_sample__intval(sample, "rw");
}
static bool ioport_event_begin(struct perf_sample *sample,
/* The time of emulation msr is from kvm_msr to kvm_entry. */
static void msr_event_get_key(struct perf_sample *sample, struct event_key *key)
{
- key->key = evsel__intval(sample->evsel, sample, "ecx");
- key->info = evsel__intval(sample->evsel, sample, "write");
+ key->key = perf_sample__intval(sample, "ecx");
+ key->info = perf_sample__intval(sample, "write");
}
static bool msr_event_begin(struct perf_sample *sample, struct event_key *key)
uint16_t e_machine = evsel__e_machine(sample->evsel, /*e_flags=*/NULL);
key->info = 0;
- key->key = evsel__intval(sample->evsel, sample, kvm_exit_reason(e_machine));
+ key->key = perf_sample__intval(sample, kvm_exit_reason(e_machine));
}