From: Namhyung Kim <namhyung@kernel.org>
To: Jiebin Sun <jiebin.sun@intel.com>
Cc: acme@kernel.org, mingo@redhat.com, peterz@infradead.org,
adrian.hunter@intel.com, alexander.shishkin@linux.intel.com,
irogers@google.com, james.clark@linaro.org, jolsa@kernel.org,
mark.rutland@arm.com, dapeng1.mi@linux.intel.com,
thomas.falcon@intel.com, tianyou.li@intel.com,
wangyang.guo@intel.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 6/9] perf c2c: add function view hierarchy entry creation
Date: Wed, 12 Aug 2026 22:03:10 +0900 [thread overview]
Message-ID: <anxvDnc2Kx-OSQEj@google.com> (raw)
In-Reply-To: <20260810052647.588867-7-jiebin.sun@intel.com>
On Mon, Aug 10, 2026 at 01:26:44PM +0800, Jiebin Sun wrote:
> Add the entry-creation layer: owned-reference child allocation and
> insertion, and the level-1/2/3 lookup-or-create functions keyed by
> function symbol (level 1 read-side, level 2 writer) and by the source
> cacheline's existing index (level 3).
>
> Give synthetic children normal entry operations and acquire their thread
> and map-symbol references. This lets the hierarchy teardown use
> hist_entry__delete() for the common fields while the function-view free
> callback handles the private child tree and containing allocation.
>
> Reuse cacheline_idx to preserve the source entry identity without adding
> function-view-only state. The browser can later use the same index to find
> the original cacheline entry.
>
> These are driven by the hierarchy builder in the next patch and are
> __maybe_unused until then.
>
> Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Falcon <thomas.falcon@intel.com>
> Reviewed-by: Tianyou Li <tianyou.li@intel.com>
> Reviewed-by: Wangyang Guo <wangyang.guo@intel.com>
> ---
> tools/perf/ui/browsers/c2c-function.c | 293 +++++++++++++++++++++++++-
> 1 file changed, 282 insertions(+), 11 deletions(-)
>
> diff --git a/tools/perf/ui/browsers/c2c-function.c b/tools/perf/ui/browsers/c2c-function.c
> index 4bf8406fde55..4099d4c7e7b4 100644
> --- a/tools/perf/ui/browsers/c2c-function.c
> +++ b/tools/perf/ui/browsers/c2c-function.c
> @@ -28,6 +28,7 @@
> #include "../../util/addr_location.h"
> #include "../../util/cacheline.h"
> #include "../../util/debug.h"
> +#include "../../util/dso.h"
> #include "../../util/hist.h"
> #include "../../util/map.h"
> #include "../../util/mem-events.h"
> @@ -57,12 +58,34 @@ static inline __maybe_unused u64 c2c_hitm_count(const struct c2c_stats *stats)
> return stats->tot_hitm;
> }
>
> -static inline __maybe_unused bool symbol_name_equal(struct symbol *a, struct symbol *b)
> +static int64_t c2c_function_cmp(const struct map_symbol *left,
> + const struct map_symbol *right)
> {
> - /* Two unknown symbols compare equal, matching cmp_null() in util/sort.c. */
> - if (!a || !b)
> - return a == b;
> - return arch__compare_symbol_names(a->name, b->name) == 0;
> + const struct dso *left_dso = left->map ? map__dso(left->map) : NULL;
> + const struct dso *right_dso = right->map ? map__dso(right->map) : NULL;
> + int ret;
> +
> + if (!left_dso || !right_dso) {
> + if (left_dso != right_dso)
> + return left_dso ? 1 : -1;
What if both DSOs are NULL?
Thanks,
Namhyung
> + } else {
> + /*
> + * Use the same DSO name as _sort__dso_cmp() (short name unless
> + * verbose), so this matches the DSO comparison the level-1
> + * entries are deduplicated by; otherwise same-basename DSOs
> + * could be split or merged inconsistently across levels.
> + */
> + const char *left_name = verbose > 0 ?
> + dso__long_name(left_dso) : dso__short_name(left_dso);
> + const char *right_name = verbose > 0 ?
> + dso__long_name(right_dso) : dso__short_name(right_dso);
> +
> + ret = strcmp(left_name, right_name);
> + if (ret)
> + return ret;
> + }
> +
> + return _sort__sym_cmp(left->sym, right->sym);
> }
next prev parent reply other threads:[~2026-08-12 13:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 5:26 [PATCH v8 0/9] perf c2c: add a function view Jiebin Sun
2026-08-10 5:26 ` [PATCH v8 1/9] perf c2c: extract shared data structures into util/c2c.h Jiebin Sun
2026-08-10 5:26 ` [PATCH v8 2/9] perf c2c: add function view browser skeleton Jiebin Sun
2026-08-12 8:26 ` Namhyung Kim
2026-08-10 5:26 ` [PATCH v8 3/9] perf c2c: add column rendering for function view Jiebin Sun
2026-08-12 8:43 ` Namhyung Kim
2026-08-10 5:26 ` [PATCH v8 4/9] perf c2c: add HPP list parsing for function view columns Jiebin Sun
2026-08-10 5:26 ` [PATCH v8 5/9] perf c2c: add function view stats merge and memory management Jiebin Sun
2026-08-10 5:26 ` [PATCH v8 6/9] perf c2c: add function view hierarchy entry creation Jiebin Sun
2026-08-10 5:49 ` sashiko-bot
2026-08-12 1:47 ` Namhyung Kim
2026-08-12 13:01 ` Namhyung Kim
2026-08-12 13:03 ` Namhyung Kim [this message]
2026-08-10 5:26 ` [PATCH v8 7/9] perf c2c: build and finalize the function view hierarchy Jiebin Sun
2026-08-10 5:26 ` [PATCH v8 8/9] perf c2c: add function view browser UI and cacheline detail Jiebin Sun
2026-08-10 5:26 ` [PATCH v8 9/9] perf c2c: document function view in perf-c2c man page Jiebin Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anxvDnc2Kx-OSQEj@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jiebin.sun@intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=thomas.falcon@intel.com \
--cc=tianyou.li@intel.com \
--cc=wangyang.guo@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox