diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-07-05 02:56:05 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-11 23:00:39 -0400 |
commit | a5051979f533afc65112cc42a20f25db08bf2272 (patch) | |
tree | 3eeb78551f186284d99fc2abbc1d16957a960086 /tools/perf | |
parent | f542e7670e48bc9d0aed351c1fd2ae0b65cc6f68 (diff) |
perf hists: Introduce hists__add_entry_ops function
Introducing hists__add_entry_ops function to allow using the allocation
callbacks externally.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1467701765-26194-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/hist.c | 42 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 11 |
2 files changed, 46 insertions, 7 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 355b7601ddb7..a18d142cdca3 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -559,13 +559,15 @@ out: | |||
559 | return he; | 559 | return he; |
560 | } | 560 | } |
561 | 561 | ||
562 | struct hist_entry *hists__add_entry(struct hists *hists, | 562 | static struct hist_entry* |
563 | struct addr_location *al, | 563 | __hists__add_entry(struct hists *hists, |
564 | struct symbol *sym_parent, | 564 | struct addr_location *al, |
565 | struct branch_info *bi, | 565 | struct symbol *sym_parent, |
566 | struct mem_info *mi, | 566 | struct branch_info *bi, |
567 | struct perf_sample *sample, | 567 | struct mem_info *mi, |
568 | bool sample_self) | 568 | struct perf_sample *sample, |
569 | bool sample_self, | ||
570 | struct hist_entry_ops *ops) | ||
569 | { | 571 | { |
570 | struct hist_entry entry = { | 572 | struct hist_entry entry = { |
571 | .thread = al->thread, | 573 | .thread = al->thread, |
@@ -592,11 +594,37 @@ struct hist_entry *hists__add_entry(struct hists *hists, | |||
592 | .transaction = sample->transaction, | 594 | .transaction = sample->transaction, |
593 | .raw_data = sample->raw_data, | 595 | .raw_data = sample->raw_data, |
594 | .raw_size = sample->raw_size, | 596 | .raw_size = sample->raw_size, |
597 | .ops = ops, | ||
595 | }; | 598 | }; |
596 | 599 | ||
597 | return hists__findnew_entry(hists, &entry, al, sample_self); | 600 | return hists__findnew_entry(hists, &entry, al, sample_self); |
598 | } | 601 | } |
599 | 602 | ||
603 | struct hist_entry *hists__add_entry(struct hists *hists, | ||
604 | struct addr_location *al, | ||
605 | struct symbol *sym_parent, | ||
606 | struct branch_info *bi, | ||
607 | struct mem_info *mi, | ||
608 | struct perf_sample *sample, | ||
609 | bool sample_self) | ||
610 | { | ||
611 | return __hists__add_entry(hists, al, sym_parent, bi, mi, | ||
612 | sample, sample_self, NULL); | ||
613 | } | ||
614 | |||
615 | struct hist_entry *hists__add_entry_ops(struct hists *hists, | ||
616 | struct hist_entry_ops *ops, | ||
617 | struct addr_location *al, | ||
618 | struct symbol *sym_parent, | ||
619 | struct branch_info *bi, | ||
620 | struct mem_info *mi, | ||
621 | struct perf_sample *sample, | ||
622 | bool sample_self) | ||
623 | { | ||
624 | return __hists__add_entry(hists, al, sym_parent, bi, mi, | ||
625 | sample, sample_self, ops); | ||
626 | } | ||
627 | |||
600 | static int | 628 | static int |
601 | iter_next_nop_entry(struct hist_entry_iter *iter __maybe_unused, | 629 | iter_next_nop_entry(struct hist_entry_iter *iter __maybe_unused, |
602 | struct addr_location *al __maybe_unused) | 630 | struct addr_location *al __maybe_unused) |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 0a03e08be503..49aa4fac148f 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "ui/progress.h" | 10 | #include "ui/progress.h" |
11 | 11 | ||
12 | struct hist_entry; | 12 | struct hist_entry; |
13 | struct hist_entry_ops; | ||
13 | struct addr_location; | 14 | struct addr_location; |
14 | struct symbol; | 15 | struct symbol; |
15 | 16 | ||
@@ -127,6 +128,16 @@ struct hist_entry *hists__add_entry(struct hists *hists, | |||
127 | struct mem_info *mi, | 128 | struct mem_info *mi, |
128 | struct perf_sample *sample, | 129 | struct perf_sample *sample, |
129 | bool sample_self); | 130 | bool sample_self); |
131 | |||
132 | struct hist_entry *hists__add_entry_ops(struct hists *hists, | ||
133 | struct hist_entry_ops *ops, | ||
134 | struct addr_location *al, | ||
135 | struct symbol *sym_parent, | ||
136 | struct branch_info *bi, | ||
137 | struct mem_info *mi, | ||
138 | struct perf_sample *sample, | ||
139 | bool sample_self); | ||
140 | |||
130 | int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, | 141 | int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, |
131 | int max_stack_depth, void *arg); | 142 | int max_stack_depth, void *arg); |
132 | 143 | ||