tools/perf/ui/gtk/hists.c

Source file repositories/reference/linux-study-clean/tools/perf/ui/gtk/hists.c

File Facts

System
Linux kernel
Corpus path
tools/perf/ui/gtk/hists.c
Extension
.c
Size
17405 bytes
Lines
682
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.

Dependency Surface

Detected Declarations

Annotated Snippet

list_for_each_entry(chain, &node->parent_val, list) {
			char buf[128];

			gtk_tree_store_append(store, &iter, &new_parent);

			callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
			gtk_tree_store_set(store, &iter, 0, buf, -1);

			callchain_list__sym_name(chain, buf, sizeof(buf), false);
			gtk_tree_store_set(store, &iter, col, buf, -1);

			if (need_new_parent) {
				/*
				 * Only show the top-most symbol in a callchain
				 * if it's not the only callchain.
				 */
				new_parent = iter;
				need_new_parent = false;
			}
		}

		list_for_each_entry(chain, &node->val, list) {
			char buf[128];

			gtk_tree_store_append(store, &iter, &new_parent);

			callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
			gtk_tree_store_set(store, &iter, 0, buf, -1);

			callchain_list__sym_name(chain, buf, sizeof(buf), false);
			gtk_tree_store_set(store, &iter, col, buf, -1);

			if (need_new_parent) {
				/*
				 * Only show the top-most symbol in a callchain
				 * if it's not the only callchain.
				 */
				new_parent = iter;
				need_new_parent = false;
			}
		}
	}
}

static void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *store,
					   GtkTreeIter *parent, int col, u64 total)
{
	struct rb_node *nd;

	for (nd = rb_first(root); nd; nd = rb_next(nd)) {
		struct callchain_node *node;
		struct callchain_list *chain;
		GtkTreeIter iter;
		char buf[64];
		char *str, *str_alloc = NULL;
		bool first = true;

		node = rb_entry(nd, struct callchain_node, rb_node);

		callchain_node__make_parent_list(node);

		list_for_each_entry(chain, &node->parent_val, list) {
			char name[1024];

			callchain_list__sym_name(chain, name, sizeof(name), false);

			if (asprintf(&str, "%s%s%s",
				     first ? "" : str_alloc,
				     first ? "" : symbol_conf.field_sep ?: "; ",
				     name) < 0)
				return;

			first = false;
			free(str_alloc);
			str_alloc = str;
		}

		list_for_each_entry(chain, &node->val, list) {
			char name[1024];

			callchain_list__sym_name(chain, name, sizeof(name), false);

			if (asprintf(&str, "%s%s%s",
				     first ? "" : str_alloc,
				     first ? "" : symbol_conf.field_sep ?: "; ",
				     name) < 0)
				return;

			first = false;
			free(str_alloc);

Annotation

Implementation Notes