aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index fca1d4402910..e8219990f8b8 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -30,12 +30,14 @@ static int hists__add_entry(struct hists *self,
30 return -ENOMEM; 30 return -ENOMEM;
31} 31}
32 32
33static int diff__process_sample_event(event_t *event, struct perf_session *session) 33static int diff__process_sample_event(union perf_event *event,
34 struct perf_sample *sample,
35 struct perf_evsel *evsel __used,
36 struct perf_session *session)
34{ 37{
35 struct addr_location al; 38 struct addr_location al;
36 struct sample_data data = { .period = 1, };
37 39
38 if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) { 40 if (perf_event__preprocess_sample(event, session, &al, sample, NULL) < 0) {
39 pr_warning("problem processing %d event, skipping it.\n", 41 pr_warning("problem processing %d event, skipping it.\n",
40 event->header.type); 42 event->header.type);
41 return -1; 43 return -1;
@@ -44,22 +46,24 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
44 if (al.filtered || al.sym == NULL) 46 if (al.filtered || al.sym == NULL)
45 return 0; 47 return 0;
46 48
47 if (hists__add_entry(&session->hists, &al, data.period)) { 49 if (hists__add_entry(&session->hists, &al, sample->period)) {
48 pr_warning("problem incrementing symbol period, skipping event\n"); 50 pr_warning("problem incrementing symbol period, skipping event\n");
49 return -1; 51 return -1;
50 } 52 }
51 53
52 session->hists.stats.total_period += data.period; 54 session->hists.stats.total_period += sample->period;
53 return 0; 55 return 0;
54} 56}
55 57
56static struct perf_event_ops event_ops = { 58static struct perf_event_ops event_ops = {
57 .sample = diff__process_sample_event, 59 .sample = diff__process_sample_event,
58 .mmap = event__process_mmap, 60 .mmap = perf_event__process_mmap,
59 .comm = event__process_comm, 61 .comm = perf_event__process_comm,
60 .exit = event__process_task, 62 .exit = perf_event__process_task,
61 .fork = event__process_task, 63 .fork = perf_event__process_task,
62 .lost = event__process_lost, 64 .lost = perf_event__process_lost,
65 .ordered_samples = true,
66 .ordering_requires_timestamps = true,
63}; 67};
64 68
65static void perf_session__insert_hist_entry_by_name(struct rb_root *root, 69static void perf_session__insert_hist_entry_by_name(struct rb_root *root,
@@ -141,8 +145,8 @@ static int __cmd_diff(void)
141 int ret, i; 145 int ret, i;
142 struct perf_session *session[2]; 146 struct perf_session *session[2];
143 147
144 session[0] = perf_session__new(input_old, O_RDONLY, force, false); 148 session[0] = perf_session__new(input_old, O_RDONLY, force, false, &event_ops);
145 session[1] = perf_session__new(input_new, O_RDONLY, force, false); 149 session[1] = perf_session__new(input_new, O_RDONLY, force, false, &event_ops);
146 if (session[0] == NULL || session[1] == NULL) 150 if (session[0] == NULL || session[1] == NULL)
147 return -ENOMEM; 151 return -ENOMEM;
148 152
@@ -173,7 +177,7 @@ static const char * const diff_usage[] = {
173static const struct option options[] = { 177static const struct option options[] = {
174 OPT_INCR('v', "verbose", &verbose, 178 OPT_INCR('v', "verbose", &verbose,
175 "be more verbose (show symbol address, etc)"), 179 "be more verbose (show symbol address, etc)"),
176 OPT_BOOLEAN('m', "displacement", &show_displacement, 180 OPT_BOOLEAN('M', "displacement", &show_displacement,
177 "Show position displacement relative to baseline"), 181 "Show position displacement relative to baseline"),
178 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 182 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
179 "dump raw trace in ASCII"), 183 "dump raw trace in ASCII"),
@@ -191,6 +195,8 @@ static const struct option options[] = {
191 OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator", 195 OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
192 "separator for columns, no spaces will be added between " 196 "separator for columns, no spaces will be added between "
193 "columns '.' is reserved."), 197 "columns '.' is reserved."),
198 OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
199 "Look for files with symbols relative to this directory"),
194 OPT_END() 200 OPT_END()
195}; 201};
196 202