mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-08 15:33:47 +00:00
perf script: Stop using pevent directly
We can get all that is needed using just event_format, that is available via evsel->tp_format now. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-2hsr1686epa9f0vx4yg7z2zj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
7f7f8d0bea
commit
9782243353
6 changed files with 28 additions and 47 deletions
|
@ -28,11 +28,6 @@ static bool system_wide;
|
|||
static const char *cpu_list;
|
||||
static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
|
||||
|
||||
struct perf_script {
|
||||
struct perf_tool tool;
|
||||
struct perf_session *session;
|
||||
};
|
||||
|
||||
enum perf_output_field {
|
||||
PERF_OUTPUT_COMM = 1U << 0,
|
||||
PERF_OUTPUT_TID = 1U << 1,
|
||||
|
@ -399,11 +394,8 @@ static void print_sample_bts(union perf_event *event,
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
static void process_event(union perf_event *event __unused,
|
||||
struct pevent *pevent __unused,
|
||||
struct perf_sample *sample,
|
||||
struct perf_evsel *evsel,
|
||||
struct machine *machine,
|
||||
static void process_event(union perf_event *event, struct perf_sample *sample,
|
||||
struct perf_evsel *evsel, struct machine *machine,
|
||||
struct thread *thread)
|
||||
{
|
||||
struct perf_event_attr *attr = &evsel->attr;
|
||||
|
@ -488,7 +480,6 @@ static int process_sample_event(struct perf_tool *tool __used,
|
|||
struct machine *machine)
|
||||
{
|
||||
struct addr_location al;
|
||||
struct perf_script *scr = container_of(tool, struct perf_script, tool);
|
||||
struct thread *thread = machine__findnew_thread(machine, event->ip.tid);
|
||||
|
||||
if (thread == NULL) {
|
||||
|
@ -520,27 +511,24 @@ static int process_sample_event(struct perf_tool *tool __used,
|
|||
if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
|
||||
return 0;
|
||||
|
||||
scripting_ops->process_event(event, scr->session->pevent,
|
||||
sample, evsel, machine, thread);
|
||||
scripting_ops->process_event(event, sample, evsel, machine, thread);
|
||||
|
||||
evsel->hists.stats.total_period += sample->period;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct perf_script perf_script = {
|
||||
.tool = {
|
||||
.sample = process_sample_event,
|
||||
.mmap = perf_event__process_mmap,
|
||||
.comm = perf_event__process_comm,
|
||||
.exit = perf_event__process_task,
|
||||
.fork = perf_event__process_task,
|
||||
.attr = perf_event__process_attr,
|
||||
.event_type = perf_event__process_event_type,
|
||||
.tracing_data = perf_event__process_tracing_data,
|
||||
.build_id = perf_event__process_build_id,
|
||||
.ordered_samples = true,
|
||||
.ordering_requires_timestamps = true,
|
||||
},
|
||||
static struct perf_tool perf_script = {
|
||||
.sample = process_sample_event,
|
||||
.mmap = perf_event__process_mmap,
|
||||
.comm = perf_event__process_comm,
|
||||
.exit = perf_event__process_task,
|
||||
.fork = perf_event__process_task,
|
||||
.attr = perf_event__process_attr,
|
||||
.event_type = perf_event__process_event_type,
|
||||
.tracing_data = perf_event__process_tracing_data,
|
||||
.build_id = perf_event__process_build_id,
|
||||
.ordered_samples = true,
|
||||
.ordering_requires_timestamps = true,
|
||||
};
|
||||
|
||||
extern volatile int session_done;
|
||||
|
@ -556,7 +544,7 @@ static int __cmd_script(struct perf_session *session)
|
|||
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
ret = perf_session__process_events(session, &perf_script.tool);
|
||||
ret = perf_session__process_events(session, &perf_script);
|
||||
|
||||
if (debug_mode)
|
||||
pr_err("Misordered timestamps: %" PRIu64 "\n", nr_unordered);
|
||||
|
@ -1339,12 +1327,10 @@ int cmd_script(int argc, const char **argv, const char *prefix __used)
|
|||
setup_pager();
|
||||
|
||||
session = perf_session__new(input_name, O_RDONLY, 0, false,
|
||||
&perf_script.tool);
|
||||
&perf_script);
|
||||
if (session == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
perf_script.session = session;
|
||||
|
||||
if (cpu_list) {
|
||||
if (perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap))
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue