[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101117131037.GD5464@nowhere>
Date: Wed, 17 Nov 2010 14:10:38 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...e.hu>, Pekka Enberg <penberg@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Darren Hart <dvhart@...ux.intel.com>,
Arjan van de Ven <arjan@...radead.org>
Subject: Re: [patch] trace: Add user-space event tracing/injection
On Wed, Nov 17, 2010 at 01:29:54PM +0100, Peter Zijlstra wrote:
> On Wed, 2010-11-17 at 13:07 +0100, Ingo Molnar wrote:
>
> > Subject: trace: Add user-space event tracing/injection
> > From: Ingo Molnar <mingo@...e.hu>
> > Date: Wed Nov 17 10:11:53 CET 2010
> >
> > This feature (suggested by Darren Hart and Pekka Engberg) allows user-space
> > programs to print trace events in a very simple and self-contained way:
> >
> > #include <sys/prctl.h>
> > #include <string.h>
> >
> > #define PR_TASK_PERF_USER_TRACE 35
> >
> > int main(void)
> > {
> > char *msg = "Hello World!\n";
> >
> > prctl(PR_TASK_PERF_USER_TRACE, msg, strlen(msg));
> >
> > return 0;
> > }
> >
> > These show up in 'trace' output as:
> >
> > $ trace report
> > #
> > # trace events of 'sleep 1':
> > #
> > testit/ 6006 ( 0.002 ms): <"Hello World!">
> > testit/ 6006 ( 0.002 ms): <"Hello World!">
> >
> > Suggested-by: Darren Hart <dvhart@...ux.intel.com>
> > Suggested-by: Pekka Enberg <penberg@...nel.org>
> > Signed-off-by: Ingo Molnar <mingo@...e.hu>
>
> I really dislike abusing prctl(), I understand your reasons, but it
> still sucks.
>
> Also, the naming doesn't work, you've implemented a trace event, that's
> got nothing to do with perf, so the PR_TASK_PERF_ prefix is incorrect.
Why not using write() on the perf event fd?
So that you don't only limit to a custom new simple event (which should
match most needs) but you can also inject whatever existing event you like.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists