summaryrefslogtreecommitdiff
path: root/tools/perf/util/c2c.h
AgeCommit message (Collapse)Author
8 daysperf c2c: add function view browser UI and cacheline detailJiebin Sun
Add the browser front end: create/run/delete the hist_browser and add the title. The d shortcut opens the existing per-cacheline detail view for the selected level-3 cacheline. Level-3 entries retain the source cacheline index, so the shortcut can locate the original entry without relying on a potentially ambiguous virtual address. Report a warning when the common model rejects a cacheline coalescing field list without `iaddr`. Without it, the detail histograms may already have merged samples from different functions and cannot support reliable function attribution. Keep visible-row accounting local to the function view by wrapping the generic browser refresh callback and recounting the currently reachable hierarchy before each redraw. This keeps navigation correct when a level-1 row is collapsed while level-3 descendants remain expanded, without adding C2C-specific hooks to the shared hist_browser. Also handle Ctrl-C like the other function-view exit keys. Keep callchains hidden while the function browser runs, restoring the user's setting while opening the cacheline detail view. Wire the builder into perf_c2c__browse_function_view(). Signed-off-by: Jiebin Sun <jiebin.sun@intel.com> Reviewed-by: Tianyou Li <tianyou.li@intel.com> Reviewed-by: Wangyang Guo <wangyang.guo@intel.com> Reviewed-by: Ian Rogers <irogers@google.com> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: James Clark <james.clark@linaro.org> Cc: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
8 daysperf c2c: build and finalize the function view hierarchyJiebin Sun
Add the builder that walks the top-level cacheline entries and, for each read-side function, correlates the functions that write the same lines (level 2) and the specific cachelines they contend over (level 3) within each retained detail histogram. Aggregate the write traffic per contending function, resort by store count, and prune writers/functions with no contention. The finalize pass then computes the Cycles % denominator from the surviving level-1 entries after pruning, so the column shows each function's share of the functions retained in the table rather than of the whole recording -- the semantics documented for Cycles % in perf-c2c.txt. Expose c2c_function__build() and c2c_function__reset() for the TUI front end added by the next patch. The builder requires iaddr in the cacheline coalescing fields and returns the completed hists through an output argument. Validate the inputs before replacing an existing model. Function-view entries do not carry callchains. Suppress callchain handling while building and tearing down the model so the common API does not depend on the caller's current callchain setting. Signed-off-by: Jiebin Sun <jiebin.sun@intel.com> Reviewed-by: Tianyou Li <tianyou.li@intel.com> Reviewed-by: Wangyang Guo <wangyang.guo@intel.com> Reviewed-by: Ian Rogers <irogers@google.com> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: James Clark <james.clark@linaro.org> Cc: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
8 daysperf c2c: add function view hierarchy entry creationJiebin Sun
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. Add c2c_function__find_cacheline() to locate the original cacheline entry by the same index. 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> Reviewed-by: Tianyou Li <tianyou.li@intel.com> Reviewed-by: Wangyang Guo <wangyang.guo@intel.com> Reviewed-by: Ian Rogers <irogers@google.com> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: James Clark <james.clark@linaro.org> Cc: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
8 daysperf c2c: extract shared data structures into util/c2c.hJiebin Sun
The function browser belongs in libperf-ui.a, but that archive is also linked into python/perf.so, where builtin command objects are unavailable. The browser therefore cannot depend on types or callbacks owned by builtin-c2c.c. Move c2c_hists, compute_stats, c2c_hist_entry, and the shared column formatting definitions from builtin-c2c.c to a new util/c2c.h. Move c2c_fmt_free() and c2c_fmt_equal() to a new util/c2c.c. Keep struct perf_c2c, the command instance, and perf_c2c__browse_cacheline() private to builtin-c2c.c. No functional change. Signed-off-by: Jiebin Sun <jiebin.sun@intel.com> Reviewed-by: Tianyou Li <tianyou.li@intel.com> Reviewed-by: Wangyang Guo <wangyang.guo@intel.com> Reviewed-by: Ian Rogers <irogers@google.com> Cc: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: James Clark <james.clark@linaro.org> Cc: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>