diff options
author | Namhyung Kim <namhyung@kernel.org> | 2022-12-15 11:28:14 -0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-12-21 14:52:40 -0300 |
commit | cb6e92c764272ca288398ad6442bbb0f064c2da8 (patch) | |
tree | ed5c74dfdde54c49e025b0cbf341cdd5ecf91546 /tools/perf/util/hist.c | |
parent | d5e33ce06ba4a0fcf7815ff9edc3f651f7ae502e (diff) |
perf hist: Add perf_hpp_fmt->init() callback
In __hists__insert_output_entry(), it calls fmt->sort() for dynamic
entries with NULL to update column width for tracepoint fields.
But it's a hacky abuse of the sort callback, better to have a proper
callback for that. I'll add more use cases later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20221215192817.2734573-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r-- | tools/perf/util/hist.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 17a05e943b44..b6e4b4edde43 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1781,8 +1781,8 @@ static void hierarchy_insert_output_entry(struct rb_root_cached *root, /* update column width of dynamic entry */ perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { - if (perf_hpp__is_dynamic_entry(fmt)) - fmt->sort(fmt, he, NULL); + if (fmt->init) + fmt->init(fmt, he); } } @@ -1879,10 +1879,10 @@ static void __hists__insert_output_entry(struct rb_root_cached *entries, rb_link_node(&he->rb_node, parent, p); rb_insert_color_cached(&he->rb_node, entries, leftmost); + /* update column width of dynamic entries */ perf_hpp_list__for_each_sort_list(&perf_hpp_list, fmt) { - if (perf_hpp__is_dynamic_entry(fmt) && - perf_hpp__defined_dynamic_entry(fmt, he->hists)) - fmt->sort(fmt, he, NULL); /* update column width */ + if (fmt->init) + fmt->init(fmt, he); } } |