lkml.org 
[lkml]   [2009]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/4] perf tools: Unify swapper tasks naming
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;



\
 
 \ /
  Last update: 2009-08-31 06:55    [W:0.065 / U:9.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site