Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753932AbZGTUis (ORCPT ); Mon, 20 Jul 2009 16:38:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753559AbZGTUip (ORCPT ); Mon, 20 Jul 2009 16:38:45 -0400 Received: from casper.infradead.org ([85.118.1.10]:52109 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752995AbZGTUip (ORCPT ); Mon, 20 Jul 2009 16:38:45 -0400 Subject: Re: [PATCH] sched: Provide iowait counters From: Peter Zijlstra To: Steven Rostedt Cc: Arjan van de Ven , Linux Kernel Mailing List , Ingo Molnar , "Kok, Auke-jan H" , =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker In-Reply-To: References: <4A64B813.1080506@linux.intel.com> <1248117369.23509.33.camel@laptop> <1248120676.23509.41.camel@laptop> Content-Type: text/plain Date: Mon, 20 Jul 2009 22:38:36 +0200 Message-Id: <1248122316.23509.48.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2259 Lines: 76 On Mon, 2009-07-20 at 16:26 -0400, Steven Rostedt wrote: > > +#define _TRACE_PROFILE(call, proto, args, assign) \ > > static void ftrace_profile_##call(proto) \ > > { \ > > - extern void perf_tpcounter_event(int); \ > > - perf_tpcounter_event(event_##call.id); \ > > + extern void perf_tpcounter_event(int, u64, u64); \ > > + u64 addr = 0, count = 1; \ > > + { assign; } \ > > + perf_tpcounter_event(event_##call.id, addr, count); \ > > The problem here is that the assign also will do the : > > TP_fast_assign( > __entry->pid = p->pid; > __entry->time = time; > > part, thus you will probably get errors in processing the __entry part. Oh, right, no macros wrapping that.. > What about doing instead: > > TRACE_EVENT(sched_iowait, > > TP_PROTO(struct task_struct *p, u64 time), > > TP_ARGS(p, time), > > TP_STRUCT__entry( > __field(pid_t, pid ) > __field(u64, time) > ), > > TP_fast_assign( > __entry->pid = p->pid; > __entry->time = time; > > ) __perf_count(time), > > TP_printk("task %d waited for IO for %Lu ns", > __entry->pid, __entry->time) > ); > > Then we could simply do: > > #undef __perf_count > #define __perf_count(a) > > [ do all the ftrace event work ] > > #undef TP_fast_assign > #define TP_fast_assign(a...) > > #undef __perf_count > #define __perf_count(c) count = (c); Hmm, should we maybe do something like: TP_fast_assign( ... ) TP_perf_assign( addr = 0; count = time; ), So we can extend it over time? But otherwise, yes, looks nice. Lets make it happen ;-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/