Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9c5143a authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Use an accessor to read thread comm



As the thread comm is going to be implemented by way of a more
complicated data structure than just a pointer to a string from the
thread struct, convert the readers of comm to use an accessor instead of
accessing it directly.

The accessor will be later overriden to support an enhanced comm
implementation.

Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-wr683zwy94hmj4ibogmnv9ce@git.kernel.org


[ Rename thread__comm_curr() to thread__comm_str() ]
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
[ Fixed up some minor const pointer issues ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6e6dc401
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
		return -1;
	}

	dump_printf(" ... thread: %s:%d\n", thread->comm, thread->tid);
	dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid);

	if (evsel->handler.func != NULL) {
		tracepoint_handler f = evsel->handler.func;
+1 −1
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ static void dump_threads(void)
	while (node) {
		st = container_of(node, struct thread_stat, rb);
		t = perf_session__findnew(session, st->tid);
		pr_info("%10d: %s\n", st->tid, t->comm);
		pr_info("%10d: %s\n", st->tid, thread__comm_str(t));
		node = rb_next(node);
	};
}
+8 −8
Original line number Diff line number Diff line
@@ -737,12 +737,12 @@ static int replay_fork_event(struct perf_sched *sched,

	if (verbose) {
		printf("fork event\n");
		printf("... parent: %s/%d\n", parent->comm, parent->tid);
		printf("...  child: %s/%d\n", child->comm, child->tid);
		printf("... parent: %s/%d\n", thread__comm_str(parent), parent->tid);
		printf("...  child: %s/%d\n", thread__comm_str(child), child->tid);
	}

	register_pid(sched, parent->tid, parent->comm);
	register_pid(sched, child->tid, child->comm);
	register_pid(sched, parent->tid, thread__comm_str(parent));
	register_pid(sched, child->tid, thread__comm_str(child));
	return 0;
}

@@ -1077,7 +1077,7 @@ static int latency_migrate_task_event(struct perf_sched *sched,
	if (!atoms) {
		if (thread_atoms_insert(sched, migrant))
			return -1;
		register_pid(sched, migrant->tid, migrant->comm);
		register_pid(sched, migrant->tid, thread__comm_str(migrant));
		atoms = thread_atoms_search(&sched->atom_root, migrant, &sched->cmp_pid);
		if (!atoms) {
			pr_err("migration-event: Internal tree error");
@@ -1111,13 +1111,13 @@ static void output_lat_thread(struct perf_sched *sched, struct work_atoms *work_
	/*
	 * Ignore idle threads:
	 */
	if (!strcmp(work_list->thread->comm, "swapper"))
	if (!strcmp(thread__comm_str(work_list->thread), "swapper"))
		return;

	sched->all_runtime += work_list->total_runtime;
	sched->all_count   += work_list->nb_atoms;

	ret = printf("  %s:%d ", work_list->thread->comm, work_list->thread->tid);
	ret = printf("  %s:%d ", thread__comm_str(work_list->thread), work_list->thread->tid);

	for (i = 0; i < 24 - ret; i++)
		printf(" ");
@@ -1334,7 +1334,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel,
	printf("  %12.6f secs ", (double)timestamp/1e9);
	if (new_shortname) {
		printf("%s => %s:%d\n",
			sched_in->shortname, sched_in->comm, sched_in->tid);
		       sched_in->shortname, thread__comm_str(sched_in), sched_in->tid);
	} else {
		printf("\n");
	}
+3 −3
Original line number Diff line number Diff line
@@ -291,11 +291,11 @@ static void print_sample_start(struct perf_sample *sample,

	if (PRINT_FIELD(COMM)) {
		if (latency_format)
			printf("%8.8s ", thread->comm);
			printf("%8.8s ", thread__comm_str(thread));
		else if (PRINT_FIELD(IP) && symbol_conf.use_callchain)
			printf("%s ", thread->comm);
			printf("%s ", thread__comm_str(thread));
		else
			printf("%16s ", thread->comm);
			printf("%16s ", thread__comm_str(thread));
	}

	if (PRINT_FIELD(PID) && PRINT_FIELD(TID))
+1 −1
Original line number Diff line number Diff line
@@ -421,7 +421,7 @@ static void print_hists(struct hists *hists)
		he = rb_entry(node, struct hist_entry, rb_node_in);

		pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n",
			i, he->thread->comm, he->ms.map->dso->short_name,
			i, thread__comm_str(he->thread), he->ms.map->dso->short_name,
			he->ms.sym->name, he->stat.period);

		i++;
Loading