Re: [PATCH 3/4] perf tools: Unify swapper tasks naming
From: Frederic Weisbecker
Date: Mon Aug 31 2009 - 00:52:33 EST
On Mon, Aug 31, 2009 at 06:45:20AM +0200, Frederic Weisbecker wrote:
> In perf tools, we hardcode the pid 0 cmdline resolving to "idle"
> because the init task is not included in the COMM events.
>
> But the idle tasks secondary cpus are resolved into their "init"
> name through the COMM events.
> We have then such strange result in perf report (ditto with trace):
>
> 19.66% init [kernel] [k] acpi_idle_enter_c1
> 17.32% [idle] [kernel] [k] acpi_idle_enter_c1
>
And BTW, idle/boot cpu is the only task that has square brackets.
Either these should be removed or we could add these brackets
to every kernel task coms.
I've tried with the following patch. It doesn't change anything, I'm not
sure why, I haven't yet investigate much for now:
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d988dfb..3753c39 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3230,10 +3230,15 @@ static void perf_counter_comm_event(struct perf_comm_event *comm_event)
struct perf_cpu_context *cpuctx;
struct perf_counter_context *ctx;
unsigned int size;
- char comm[TASK_COMM_LEN];
+ char comm[TASK_COMM_LEN + 2]; /* Also reserve square backets */
memset(comm, 0, sizeof(comm));
- strncpy(comm, comm_event->task->comm, sizeof(comm));
+
+ if (comm_event->task->mm)
+ strncpy(comm, comm_event->task->comm, sizeof(comm));
+ else
+ snprintf(comm, sizeof(comm), "[%s]", comm_event->task->comm);
+
size = ALIGN(strlen(comm)+1, sizeof(u64));
comm_event->comm = comm;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/