tools/perf/ui/browsers/hists.c
Source file repositories/reference/linux-study-clean/tools/perf/ui/browsers/hists.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/ui/browsers/hists.c- Extension
.c- Size
- 97510 bytes
- Lines
- 3784
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dirent.herrno.hinttypes.hstdio.hstdlib.hstring.hlinux/rbtree.hlinux/string.hsys/ttydefaults.hlinux/time64.hlinux/zalloc.h../../util/debug.h../../util/dso.h../../util/callchain.h../../util/evsel.h../../util/evlist.h../../util/header.h../../util/hist.h../../util/machine.h../../util/map.h../../util/maps.h../../util/symbol.h../../util/map_symbol.h../../util/branch.h../../util/pstack.h../../util/sort.h../../util/top.h../../util/thread.h../../util/block-info.h../../util/util.h../../arch/common.h../browsers/hists.h
Detected Declarations
struct callchain_print_argstruct hpp_argstruct popup_actionstruct evsel_menufunction hist_browser__has_filterfunction hist_browser__get_foldingfunction hist_browser__set_title_spacefunction hist_browser__nr_entriesfunction hist_browser__update_rowsfunction hist_browser__refresh_dimensionsfunction hist_browser__resetfunction tree__folded_signfunction hist_entry__foldedfunction callchain_list__foldedfunction callchain_list__set_foldingfunction callchain_node__count_rows_rb_treefunction list_for_each_entryfunction callchain_node__count_flat_rowsfunction list_for_each_entryfunction list_for_each_entryfunction callchain_node__count_folded_rowsfunction callchain_node__count_rowsfunction list_for_each_entryfunction callchain__count_rowsfunction hierarchy_count_rowsfunction hist_entry__toggle_foldfunction callchain_list__toggle_foldfunction callchain_node__init_have_children_rb_treefunction list_for_each_entryfunction callchain_node__init_have_childrenfunction callchain__init_have_childrenfunction hist_entry__init_have_childrenfunction hist_browser__selection_has_childrenfunction hist_browser__selection_unfoldedfunction hist_browser__toggle_foldfunction callchain_node__set_folding_rb_treefunction list_for_each_entryfunction callchain_node__set_foldingfunction list_for_each_entryfunction callchain__set_foldingfunction hierarchy_set_foldingfunction hist_entry__set_foldingfunction __hist_browser__set_foldingfunction hist_browser__set_foldingfunction hist_browser__set_folding_selectedfunction ui_browser__warn_lost_eventsfunction hist_browser__titlefunction hist_browser__handle_hotkey
Annotated Snippet
struct callchain_print_arg {
/* for hists browser */
off_t row_offset;
bool is_current_entry;
/* for file dump */
FILE *fp;
int printed;
};
typedef void (*print_callchain_entry_fn)(struct hist_browser *browser,
struct callchain_list *chain,
const char *str, int offset,
unsigned short row,
struct callchain_print_arg *arg);
static void hist_browser__show_callchain_entry(struct hist_browser *browser,
struct callchain_list *chain,
const char *str, int offset,
unsigned short row,
struct callchain_print_arg *arg)
{
int color, width;
char folded_sign = callchain_list__folded(chain);
bool show_annotated = browser->show_dso && chain->ms.sym && symbol__annotation(chain->ms.sym)->src;
color = HE_COLORSET_NORMAL;
width = browser->b.width - (offset + 2);
if (ui_browser__is_current_entry(&browser->b, row)) {
browser->selection = &chain->ms;
color = HE_COLORSET_SELECTED;
arg->is_current_entry = true;
}
ui_browser__set_color(&browser->b, color);
ui_browser__gotorc(&browser->b, row, 0);
ui_browser__write_nstring(&browser->b, " ", offset);
ui_browser__printf(&browser->b, "%c", folded_sign);
ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' ');
ui_browser__write_nstring(&browser->b, str, width);
}
static void hist_browser__fprintf_callchain_entry(struct hist_browser *b __maybe_unused,
struct callchain_list *chain,
const char *str, int offset,
unsigned short row __maybe_unused,
struct callchain_print_arg *arg)
{
char folded_sign = callchain_list__folded(chain);
arg->printed += fprintf(arg->fp, "%*s%c %s\n", offset, " ",
folded_sign, str);
}
typedef bool (*check_output_full_fn)(struct hist_browser *browser,
unsigned short row);
static bool hist_browser__check_output_full(struct hist_browser *browser,
unsigned short row)
{
return browser->b.rows == row;
}
static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_unused,
unsigned short row __maybe_unused)
{
return false;
}
#define LEVEL_OFFSET_STEP 3
static int hist_browser__show_callchain_list(struct hist_browser *browser,
struct callchain_node *node,
struct callchain_list *chain,
unsigned short row, u64 total,
bool need_percent, int offset,
print_callchain_entry_fn print,
struct callchain_print_arg *arg)
{
char bf[1024], *alloc_str;
char buf[64], *alloc_str2;
const char *str;
int ret = 1;
if (arg->row_offset != 0) {
arg->row_offset--;
return 0;
}
alloc_str = NULL;
Annotation
- Immediate include surface: `dirent.h`, `errno.h`, `inttypes.h`, `stdio.h`, `stdlib.h`, `string.h`, `linux/rbtree.h`, `linux/string.h`.
- Detected declarations: `struct callchain_print_arg`, `struct hpp_arg`, `struct popup_action`, `struct evsel_menu`, `function hist_browser__has_filter`, `function hist_browser__get_folding`, `function hist_browser__set_title_space`, `function hist_browser__nr_entries`, `function hist_browser__update_rows`, `function hist_browser__refresh_dimensions`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.