diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-10-31 02:56:03 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-04 18:59:09 -0500 |
commit | 41a4e6e2a0237e8ac895f43158ef7c91ab7af157 (patch) | |
tree | 3ab45245e866404b7bc05b494e6770fc580d408a /tools/perf/util | |
parent | 87968f94fbea47df334502a0db645833ce8a848b (diff) |
perf hists: Consolidate __hists__add_*entry()
The __hists__add_{branch,mem}_entry() does almost the same thing that
__hists__add_entry() does. Consolidate them into one.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Rodrigo Campos <rodrigo@sdfg.com.ar>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1383202576-28141-2-git-send-email-namhyung@kernel.org
[ Fixup clash with new COMM infrastructure ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/hist.c | 75 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 18 |
2 files changed, 10 insertions, 83 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 30793f98c8bb..822903eaa201 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -407,73 +407,12 @@ out: | |||
407 | return he; | 407 | return he; |
408 | } | 408 | } |
409 | 409 | ||
410 | struct hist_entry *__hists__add_mem_entry(struct hists *hists, | ||
411 | struct addr_location *al, | ||
412 | struct symbol *sym_parent, | ||
413 | struct mem_info *mi, | ||
414 | u64 period, | ||
415 | u64 weight) | ||
416 | { | ||
417 | struct hist_entry entry = { | ||
418 | .thread = al->thread, | ||
419 | .comm = thread__comm(al->thread), | ||
420 | .ms = { | ||
421 | .map = al->map, | ||
422 | .sym = al->sym, | ||
423 | }, | ||
424 | .stat = { | ||
425 | .period = period, | ||
426 | .weight = weight, | ||
427 | .nr_events = 1, | ||
428 | }, | ||
429 | .cpu = al->cpu, | ||
430 | .ip = al->addr, | ||
431 | .level = al->level, | ||
432 | .parent = sym_parent, | ||
433 | .filtered = symbol__parent_filter(sym_parent), | ||
434 | .hists = hists, | ||
435 | .mem_info = mi, | ||
436 | .branch_info = NULL, | ||
437 | }; | ||
438 | return add_hist_entry(hists, &entry, al, period, weight); | ||
439 | } | ||
440 | |||
441 | struct hist_entry *__hists__add_branch_entry(struct hists *hists, | ||
442 | struct addr_location *al, | ||
443 | struct symbol *sym_parent, | ||
444 | struct branch_info *bi, | ||
445 | u64 period, | ||
446 | u64 weight) | ||
447 | { | ||
448 | struct hist_entry entry = { | ||
449 | .thread = al->thread, | ||
450 | .comm = thread__comm(al->thread), | ||
451 | .ms = { | ||
452 | .map = bi->to.map, | ||
453 | .sym = bi->to.sym, | ||
454 | }, | ||
455 | .cpu = al->cpu, | ||
456 | .ip = bi->to.addr, | ||
457 | .level = al->level, | ||
458 | .stat = { | ||
459 | .period = period, | ||
460 | .nr_events = 1, | ||
461 | .weight = weight, | ||
462 | }, | ||
463 | .parent = sym_parent, | ||
464 | .filtered = symbol__parent_filter(sym_parent), | ||
465 | .branch_info = bi, | ||
466 | .hists = hists, | ||
467 | .mem_info = NULL, | ||
468 | }; | ||
469 | |||
470 | return add_hist_entry(hists, &entry, al, period, weight); | ||
471 | } | ||
472 | |||
473 | struct hist_entry *__hists__add_entry(struct hists *hists, | 410 | struct hist_entry *__hists__add_entry(struct hists *hists, |
474 | struct addr_location *al, | 411 | struct addr_location *al, |
475 | struct symbol *sym_parent, u64 period, | 412 | struct symbol *sym_parent, |
476 | u64 weight, u64 transaction) | 413 | struct branch_info *bi, |
414 | struct mem_info *mi, | ||
415 | u64 period, u64 weight, u64 transaction) | ||
477 | { | 416 | { |
478 | struct hist_entry entry = { | 417 | struct hist_entry entry = { |
479 | .thread = al->thread, | 418 | .thread = al->thread, |
@@ -486,15 +425,15 @@ struct hist_entry *__hists__add_entry(struct hists *hists, | |||
486 | .ip = al->addr, | 425 | .ip = al->addr, |
487 | .level = al->level, | 426 | .level = al->level, |
488 | .stat = { | 427 | .stat = { |
489 | .period = period, | ||
490 | .nr_events = 1, | 428 | .nr_events = 1, |
429 | .period = period, | ||
491 | .weight = weight, | 430 | .weight = weight, |
492 | }, | 431 | }, |
493 | .parent = sym_parent, | 432 | .parent = sym_parent, |
494 | .filtered = symbol__parent_filter(sym_parent), | 433 | .filtered = symbol__parent_filter(sym_parent), |
495 | .hists = hists, | 434 | .hists = hists, |
496 | .branch_info = NULL, | 435 | .branch_info = bi, |
497 | .mem_info = NULL, | 436 | .mem_info = mi, |
498 | .transaction = transaction, | 437 | .transaction = transaction, |
499 | }; | 438 | }; |
500 | 439 | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 9d2d022cdb79..307f1c742563 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -86,7 +86,9 @@ struct hists { | |||
86 | 86 | ||
87 | struct hist_entry *__hists__add_entry(struct hists *self, | 87 | struct hist_entry *__hists__add_entry(struct hists *self, |
88 | struct addr_location *al, | 88 | struct addr_location *al, |
89 | struct symbol *parent, u64 period, | 89 | struct symbol *parent, |
90 | struct branch_info *bi, | ||
91 | struct mem_info *mi, u64 period, | ||
90 | u64 weight, u64 transaction); | 92 | u64 weight, u64 transaction); |
91 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); | 93 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); |
92 | int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); | 94 | int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); |
@@ -95,20 +97,6 @@ int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size, | |||
95 | struct hists *hists); | 97 | struct hists *hists); |
96 | void hist_entry__free(struct hist_entry *); | 98 | void hist_entry__free(struct hist_entry *); |
97 | 99 | ||
98 | struct hist_entry *__hists__add_branch_entry(struct hists *self, | ||
99 | struct addr_location *al, | ||
100 | struct symbol *sym_parent, | ||
101 | struct branch_info *bi, | ||
102 | u64 period, | ||
103 | u64 weight); | ||
104 | |||
105 | struct hist_entry *__hists__add_mem_entry(struct hists *self, | ||
106 | struct addr_location *al, | ||
107 | struct symbol *sym_parent, | ||
108 | struct mem_info *mi, | ||
109 | u64 period, | ||
110 | u64 weight); | ||
111 | |||
112 | void hists__output_resort(struct hists *self); | 100 | void hists__output_resort(struct hists *self); |
113 | void hists__collapse_resort(struct hists *self, struct ui_progress *prog); | 101 | void hists__collapse_resort(struct hists *self, struct ui_progress *prog); |
114 | 102 | ||