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.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 9a5a035cb426..8c5c11ca8c53 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -327,6 +327,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
327 struct machine *machine) 327 struct machine *machine)
328{ 328{
329 struct addr_location al; 329 struct addr_location al;
330 struct hists *hists = evsel__hists(evsel);
330 331
331 if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { 332 if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) {
332 pr_warning("problem processing %d event, skipping it.\n", 333 pr_warning("problem processing %d event, skipping it.\n",
@@ -334,7 +335,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
334 return -1; 335 return -1;
335 } 336 }
336 337
337 if (hists__add_entry(&evsel->hists, &al, sample->period, 338 if (hists__add_entry(hists, &al, sample->period,
338 sample->weight, sample->transaction)) { 339 sample->weight, sample->transaction)) {
339 pr_warning("problem incrementing symbol period, skipping event\n"); 340 pr_warning("problem incrementing symbol period, skipping event\n");
340 return -1; 341 return -1;
@@ -346,9 +347,9 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
346 * hists__output_resort() and precompute needs the total 347 * hists__output_resort() and precompute needs the total
347 * period in order to sort entries by percentage delta. 348 * period in order to sort entries by percentage delta.
348 */ 349 */
349 evsel->hists.stats.total_period += sample->period; 350 hists->stats.total_period += sample->period;
350 if (!al.filtered) 351 if (!al.filtered)
351 evsel->hists.stats.total_non_filtered_period += sample->period; 352 hists->stats.total_non_filtered_period += sample->period;
352 353
353 return 0; 354 return 0;
354} 355}
@@ -360,7 +361,7 @@ static struct perf_tool tool = {
360 .exit = perf_event__process_exit, 361 .exit = perf_event__process_exit,
361 .fork = perf_event__process_fork, 362 .fork = perf_event__process_fork,
362 .lost = perf_event__process_lost, 363 .lost = perf_event__process_lost,
363 .ordered_samples = true, 364 .ordered_events = true,
364 .ordering_requires_timestamps = true, 365 .ordering_requires_timestamps = true,
365}; 366};
366 367
@@ -382,7 +383,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist)
382 struct perf_evsel *evsel; 383 struct perf_evsel *evsel;
383 384
384 evlist__for_each(evlist, evsel) { 385 evlist__for_each(evlist, evsel) {
385 struct hists *hists = &evsel->hists; 386 struct hists *hists = evsel__hists(evsel);
386 387
387 hists__collapse_resort(hists, NULL); 388 hists__collapse_resort(hists, NULL);
388 } 389 }
@@ -631,24 +632,26 @@ static void data_process(void)
631 bool first = true; 632 bool first = true;
632 633
633 evlist__for_each(evlist_base, evsel_base) { 634 evlist__for_each(evlist_base, evsel_base) {
635 struct hists *hists_base = evsel__hists(evsel_base);
634 struct data__file *d; 636 struct data__file *d;
635 int i; 637 int i;
636 638
637 data__for_each_file_new(i, d) { 639 data__for_each_file_new(i, d) {
638 struct perf_evlist *evlist = d->session->evlist; 640 struct perf_evlist *evlist = d->session->evlist;
639 struct perf_evsel *evsel; 641 struct perf_evsel *evsel;
642 struct hists *hists;
640 643
641 evsel = evsel_match(evsel_base, evlist); 644 evsel = evsel_match(evsel_base, evlist);
642 if (!evsel) 645 if (!evsel)
643 continue; 646 continue;
644 647
645 d->hists = &evsel->hists; 648 hists = evsel__hists(evsel);
649 d->hists = hists;
646 650
647 hists__match(&evsel_base->hists, &evsel->hists); 651 hists__match(hists_base, hists);
648 652
649 if (!show_baseline_only) 653 if (!show_baseline_only)
650 hists__link(&evsel_base->hists, 654 hists__link(hists_base, hists);
651 &evsel->hists);
652 } 655 }
653 656
654 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", 657 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
@@ -659,7 +662,7 @@ static void data_process(void)
659 if (verbose || data__files_cnt > 2) 662 if (verbose || data__files_cnt > 2)
660 data__fprintf(); 663 data__fprintf();
661 664
662 hists__process(&evsel_base->hists); 665 hists__process(hists_base);
663 } 666 }
664} 667}
665 668
@@ -683,7 +686,7 @@ static int __cmd_diff(void)
683 d->session = perf_session__new(&d->file, false, &tool); 686 d->session = perf_session__new(&d->file, false, &tool);
684 if (!d->session) { 687 if (!d->session) {
685 pr_err("Failed to open %s\n", d->file.path); 688 pr_err("Failed to open %s\n", d->file.path);
686 ret = -ENOMEM; 689 ret = -1;
687 goto out_delete; 690 goto out_delete;
688 } 691 }
689 692
@@ -1143,7 +1146,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
1143 1146
1144 argc = parse_options(argc, argv, options, diff_usage, 0); 1147 argc = parse_options(argc, argv, options, diff_usage, 0);
1145 1148
1146 if (symbol__init() < 0) 1149 if (symbol__init(NULL) < 0)
1147 return -1; 1150 return -1;
1148 1151
1149 if (data_init(argc, argv) < 0) 1152 if (data_init(argc, argv) < 0)