static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct perf_annotate *ann = container_of(tool, struct perf_annotate, tool);
goto out_put;
if (!al.filtered &&
- evsel__add_sample(evsel, sample, &al, ann, machine)) {
+ evsel__add_sample(sample->evsel, sample, &al, ann, machine)) {
pr_warning("problem incrementing symbol count, "
"skipping event\n");
ret = -1;
static int process_sample_event(const struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
+ struct evsel *evsel = sample->evsel;
struct c2c_hists *c2c_hists = &c2c.hists;
struct c2c_hist_entry *c2c_he;
struct c2c_stats stats = { .nr_entries = 0, };
static int diff__process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct perf_diff *pdiff = container_of(tool, struct perf_diff, tool);
struct addr_location al;
+ struct evsel *evsel = sample->evsel;
struct hists *hists = evsel__hists(evsel);
struct hist_entry_iter iter = {
.evsel = evsel,
static int perf_event__repipe_sample(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
- struct perf_inject *inject = container_of(tool, struct perf_inject,
- tool);
+ struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
+ struct evsel *evsel = sample->evsel;
if (evsel == NULL)
return perf_event__repipe_synth(tool, event);
return f(tool, event, sample, evsel, machine);
}
- build_id__mark_dso_hit(tool, event, sample, evsel, machine);
+ build_id__mark_dso_hit(tool, event, sample, machine);
if (inject->itrace_synth_opts.set &&
(inject->itrace_synth_opts.last_branch ||
static int perf_event__convert_sample_callchain(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
+ struct evsel *evsel = sample->evsel;
struct callchain_cursor *cursor = get_tls_callchain_cursor();
union perf_event *event_copy = (void *)inject->event_copy;
struct callchain_cursor_node *node;
args->mmap_evsel, map, /*sample_in_dso=*/false);
}
-int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
- struct perf_sample *sample,
- struct evsel *evsel __maybe_unused,
- struct machine *machine)
+static int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
+ struct perf_sample *sample, struct machine *machine)
{
struct addr_location al;
struct thread *thread;
/*sample_in_dso=*/true);
}
- sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEPTH,
+ sample__for_each_callchain_node(thread, sample->evsel, sample, PERF_MAX_STACK_DEPTH,
/*symbols=*/false, mark_dso_hit_callback, &args);
thread__put(thread);
repipe:
perf_event__synthesize_sample(event_sw, evsel->core.attr.sample_type,
evsel->core.attr.read_format,
evsel->core.attr.branch_sample_type, &sample_sw);
- build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine);
+ build_id__mark_dso_hit(tool, event_sw, &sample_sw, machine);
ret = perf_event__repipe(tool, event_sw, &sample_sw, machine);
perf_sample__exit(&sample_sw);
return ret;
static int process_sample_event(const struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
+ struct evsel *evsel = sample->evsel;
int err = 0;
struct thread *thread = machine__findnew_thread(machine, sample->pid,
sample->tid);
static bool handle_kvm_event(struct perf_kvm_stat *kvm,
struct thread *thread,
- struct evsel *evsel,
struct perf_sample *sample)
{
+ struct evsel *evsel = sample->evsel;
struct vcpu_event_record *vcpu_record;
struct event_key key = { .key = INVALID_KEY,
.exit_reasons = kvm->exit_reasons };
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
int err = 0;
return -1;
}
- if (!handle_kvm_event(kvm, thread, evsel, sample))
+ if (!handle_kvm_event(kvm, thread, sample))
err = -1;
thread__put(thread);
static int perf_kwork__process_tracepoint_sample(const struct perf_tool *tool,
union perf_event *event __maybe_unused,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
+ struct evsel *evsel = sample->evsel;
int err = 0;
if (evsel->handler != NULL) {
static int process_sample_event(const struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
+ struct evsel *evsel = sample->evsel;
int err = 0;
struct thread *thread = machine__findnew_thread(machine, sample->pid,
sample->tid);
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel __maybe_unused,
struct machine *machine)
{
return dump_raw_samples(tool, event, sample, machine);
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct record *rec = container_of(tool, struct record, tool);
return 0;
rec->samples++;
- return build_id__mark_dso_hit(tool, event, sample, evsel, machine);
+ return build_id__mark_dso_hit(tool, event, sample, machine);
}
static int process_buildids(struct record *rec)
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct report *rep = container_of(tool, struct report, tool);
+ struct evsel *evsel = sample->evsel;
struct addr_location al;
struct hist_entry_iter iter = {
.evsel = evsel,
static int process_read_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample __maybe_unused,
- struct evsel *evsel,
struct machine *machine __maybe_unused)
{
struct report *rep = container_of(tool, struct report, tool);
if (rep->show_threads) {
int err = perf_read_values_add_value(&rep->show_threads_values,
event->read.pid, event->read.tid,
- evsel,
+ sample->evsel,
event->read.value);
if (err)
static int count_sample_event(const struct perf_tool *tool __maybe_unused,
union perf_event *event __maybe_unused,
- struct perf_sample *sample __maybe_unused,
- struct evsel *evsel,
+ struct perf_sample *sample,
struct machine *machine __maybe_unused)
{
- struct hists *hists = evsel__hists(evsel);
+ struct hists *hists = evsel__hists(sample->evsel);
hists__inc_nr_events(hists);
return 0;
static int perf_sched__process_tracepoint_sample(const struct perf_tool *tool __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
+ struct evsel *evsel = sample->evsel;
int err = 0;
if (evsel->handler != NULL) {
static int perf_timehist__process_sample(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
+ struct evsel *evsel = sample->evsel;
int err = 0;
struct perf_cpu this_cpu = {
.cpu = sample->cpu,
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct perf_script *scr = container_of(tool, struct perf_script, tool);
+ struct evsel *evsel = sample->evsel;
struct addr_location al;
struct addr_location addr_al;
int ret = 0;
static int process_deferred_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct perf_script *scr = container_of(tool, struct perf_script, tool);
+ struct evsel *evsel = sample->evsel;
struct perf_event_attr *attr = &evsel->core.attr;
struct evsel_script *es = evsel->priv;
unsigned int type = output_type(attr->type);
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct timechart *tchart = container_of(tool, struct timechart, tool);
+ struct evsel *evsel = sample->evsel;
if (evsel->core.attr.sample_type & PERF_SAMPLE_TIME) {
if (!tchart->first_time || tchart->first_time > sample->time)
static int trace__process_sample(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine __maybe_unused)
{
struct trace *trace = container_of(tool, struct trace, tool);
+ struct evsel *evsel = sample->evsel;
struct thread *thread;
int err = 0;
int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine)
{
struct addr_location al;
addr_location__exit(&al);
- sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEPTH,
+ sample__for_each_callchain_node(thread, sample->evsel, sample, PERF_MAX_STACK_DEPTH,
/*symbols=*/false, mark_dso_hit_callback, /*data=*/NULL);
bool is_debug, bool is_kallsyms);
int build_id__mark_dso_hit(const struct perf_tool *tool, union perf_event *event,
- struct perf_sample *sample, struct evsel *evsel,
- struct machine *machine);
-
-int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
- struct perf_sample *sample, struct evsel *evsel,
- struct machine *machine);
+ struct perf_sample *sample, struct machine *machine);
bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
int perf_session__write_buildid_table(struct perf_session *session,
static int process_sample_event(const struct perf_tool *tool,
union perf_event *_event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine __maybe_unused)
{
struct convert *c = container_of(tool, struct convert, tool);
+ struct evsel *evsel = sample->evsel;
struct evsel_priv *priv = evsel->priv;
struct ctf_writer *cw = &c->writer;
struct ctf_stream *cs;
static int process_sample_event(const struct perf_tool *tool,
union perf_event *event __maybe_unused,
struct perf_sample *sample,
- struct evsel *evsel __maybe_unused,
struct machine *machine)
{
struct convert_json *c = container_of(tool, struct convert_json, tool);
FILE *out = c->out;
struct addr_location al;
- u64 sample_type = __evlist__combined_sample_type(evsel->evlist);
+ u64 sample_type = __evlist__combined_sample_type(sample->evsel->evlist);
u8 cpumode = PERF_RECORD_MISC_USER;
addr_location__init(&al);
#ifdef HAVE_LIBTRACEEVENT
if (sample->raw_data) {
- struct tep_event *tp_format = evsel__tp_format(evsel);
+ struct tep_event *tp_format = evsel__tp_format(sample->evsel);
struct tep_format_field **fields = tp_format ? tep_event_fields(tp_format) : NULL;
if (fields) {
static int process_sample_event(const struct perf_tool *tool __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine __maybe_unused)
{
struct tpebs_retire_lat *t;
mutex_unlock(tpebs_mtx_get());
return 0;
}
- t = tpebs_retire_lat__find(evsel);
+ t = tpebs_retire_lat__find(sample->evsel);
if (!t) {
mutex_unlock(tpebs_mtx_get());
return -EINVAL;
ret = jit_inject_event(jd, event);
if (!ret)
- build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine);
+ build_id__mark_dso_hit(tool, event, &sample, jd->machine);
out:
perf_sample__exit(&sample);
return ret;
return str;
}
-static void dump_sample(struct machine *machine, struct evsel *evsel, union perf_event *event,
+static void dump_sample(struct machine *machine, union perf_event *event,
struct perf_sample *sample)
{
+ struct evsel *evsel = sample->evsel;
u64 sample_type;
char str[PAGE_SIZE_NAME_LEN];
uint16_t e_machine = EM_NONE;
sample_read__printf(sample, evsel->core.attr.read_format);
}
-static void dump_deferred_callchain(struct evsel *evsel, union perf_event *event,
- struct perf_sample *sample)
+static void dump_deferred_callchain(union perf_event *event, struct perf_sample *sample)
{
+ struct evsel *evsel = sample->evsel;
+
if (!dump_trace)
return;
return 0;
sample->evsel = container_of(sid->evsel, struct evsel, core);
- ret = tool->sample(tool, event, sample, sample->evsel, machine);
+ ret = tool->sample(tool, event, sample, machine);
sample->evsel = saved_evsel;
return ret;
}
static int evlist__deliver_sample(struct evlist *evlist, const struct perf_tool *tool,
union perf_event *event, struct perf_sample *sample,
- struct evsel *evsel, struct machine *machine)
+ struct machine *machine)
{
+ struct evsel *evsel = sample->evsel;
/* We know evsel != NULL. */
u64 sample_type = evsel->core.attr.sample_type;
u64 read_format = evsel->core.attr.read_format;
/* Standard sample delivery. */
if (!(sample_type & PERF_SAMPLE_READ))
- return tool->sample(tool, event, sample, evsel, machine);
+ return tool->sample(tool, event, sample, machine);
/* For PERF_SAMPLE_READ we have either single or group mode. */
if (read_format & PERF_FORMAT_GROUP)
struct evsel *saved_evsel = sample->evsel;
sample->evsel = evlist__id2evsel(evlist, sample->id);
- ret = tool->callchain_deferred(tool, event, sample,
- sample->evsel, machine);
+ ret = tool->callchain_deferred(tool, event, sample, machine);
sample->evsel = saved_evsel;
return ret;
}
orig_sample.evsel = evlist__id2evsel(evlist, orig_sample.id);
ret = evlist__deliver_sample(evlist, tool, de->event,
- &orig_sample, orig_sample.evsel, machine);
+ &orig_sample, machine);
perf_sample__exit(&orig_sample);
list_del(&de->list);
sample.evsel = evlist__id2evsel(evlist, sample.id);
ret = evlist__deliver_sample(evlist, tool, de->event,
- &sample, sample.evsel, machine);
+ &sample, machine);
perf_sample__exit(&sample);
list_del(&de->list);
const struct perf_tool *tool, u64 file_offset,
const char *file_path)
{
- struct evsel *evsel;
struct machine *machine;
dump_event(evlist, event, file_offset, sample, file_path);
else
assert(sample->evsel == evlist__id2evsel(evlist, sample->id));
- evsel = sample->evsel;
machine = machines__find_for_cpumode(machines, event, sample);
switch (event->header.type) {
case PERF_RECORD_SAMPLE:
- if (evsel == NULL) {
+ if (sample->evsel == NULL) {
++evlist->stats.nr_unknown_id;
return 0;
}
if (machine == NULL) {
++evlist->stats.nr_unprocessable_samples;
- dump_sample(machine, evsel, event, sample);
+ dump_sample(machine, event, sample);
return 0;
}
- dump_sample(machine, evsel, event, sample);
+ dump_sample(machine, event, sample);
if (sample->deferred_callchain && tool->merge_deferred_callchains) {
struct deferred_event *de = malloc(sizeof(*de));
size_t sz = event->header.size;
list_add_tail(&de->list, &evlist->deferred_samples);
return 0;
}
- return evlist__deliver_sample(evlist, tool, event, sample, evsel, machine);
+ return evlist__deliver_sample(evlist, tool, event, sample, machine);
case PERF_RECORD_MMAP:
return tool->mmap(tool, event, sample, machine);
case PERF_RECORD_MMAP2:
evlist->stats.total_lost_samples += event->lost_samples.lost;
return tool->lost_samples(tool, event, sample, machine);
case PERF_RECORD_READ:
- dump_read(evsel, event);
- return tool->read(tool, event, sample, evsel, machine);
+ dump_read(sample->evsel, event);
+ return tool->read(tool, event, sample, machine);
case PERF_RECORD_THROTTLE:
return tool->throttle(tool, event, sample, machine);
case PERF_RECORD_UNTHROTTLE:
case PERF_RECORD_AUX_OUTPUT_HW_ID:
return tool->aux_output_hw_id(tool, event, sample, machine);
case PERF_RECORD_CALLCHAIN_DEFERRED:
- dump_deferred_callchain(evsel, event, sample);
+ dump_deferred_callchain(event, sample);
return evlist__deliver_deferred_callchain(evlist, tool, event,
sample, machine);
default:
int process_event_sample_stub(const struct perf_tool *tool __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused,
- struct evsel *evsel __maybe_unused,
struct machine *machine __maybe_unused)
{
dump_printf(": unhandled!\n");
static int delegate_ ## name(const struct perf_tool *tool, \
union perf_event *event, \
struct perf_sample *sample, \
- struct evsel *evsel, \
struct machine *machine) \
{ \
struct delegate_tool *del_tool = container_of(tool, struct delegate_tool, tool); \
struct perf_tool *delegate = del_tool->delegate; \
- return delegate->name(delegate, event, sample, evsel, machine); \
+ return delegate->name(delegate, event, sample, machine); \
}
CREATE_DELEGATE_SAMPLE(read);
CREATE_DELEGATE_SAMPLE(sample);
struct perf_session;
union perf_event;
struct evlist;
-struct evsel;
struct perf_sample;
struct perf_tool;
struct machine;
typedef int (*event_sample)(const struct perf_tool *tool, union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel, struct machine *machine);
+ struct machine *machine);
typedef int (*event_op)(const struct perf_tool *tool, union perf_event *event,
struct perf_sample *sample, struct machine *machine);
int process_event_sample_stub(const struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
- struct evsel *evsel,
struct machine *machine);
struct delegate_tool {