Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753372Ab0LHG43 (ORCPT ); Wed, 8 Dec 2010 01:56:29 -0500 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:34246 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753274Ab0LHG41 (ORCPT ); Wed, 8 Dec 2010 01:56:27 -0500 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 From: KOSAKI Motohiro To: Steven Rostedt Subject: Re: [PATCH 3/4] tracing: Add TRACE_EVENT_CONDITIONAL() Cc: kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Frederic Weisbecker , Linus Torvalds , Theodore Tso , Arjan van de Ven , Mathieu Desnoyers , Mathieu Desnoyers In-Reply-To: <20101204023141.552849493@goodmis.org> References: <20101204021744.521599148@goodmis.org> <20101204023141.552849493@goodmis.org> Message-Id: <20101208155703.173C.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.50.07 [ja] Date: Wed, 8 Dec 2010 15:56:24 +0900 (JST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1834 Lines: 47 > From: Steven Rostedt > > There are instances in the kernel that we only want to trace > a tracepoint when a certain condition is set. But we do not > want to test for that condition in the core kernel. > If we test for that condition before calling the tracepoin, then > we will be performing that test even when tracing is not enabled. > This is 99.99% of the time. > > We currently can just filter out on that condition, but that happens > after we write to the trace buffer. We just wasted time writing to > the ring buffer for an event we never cared about. > > This patch adds: > > TRACE_EVENT_CONDITION() and DEFINE_EVENT_CONDITION() > > These have a new TP_CONDITION() argument that comes right after > the TP_ARGS(). This condition can use the parameters of TP_ARGS() > in the TRACE_EVENT() to determine if the tracepoint should be traced > or not. The TP_CONDITION() will be placed in a if (cond) trace; > > For example, for the tracepoint sched_wakeup, it is useless to > trace a wakeup event where the caller never actually wakes > anything up (where success == 0). So adding: > > TP_CONDITION(success), > > which uses the "success" parameter of the wakeup tracepoint > will have it only trace when we have successfully woken up a > task. > > Acked-by: Mathieu Desnoyers > Acked-by: Frederic Weisbecker > Cc: Arjan van de Ven > Cc: Thomas Gleixner > Signed-off-by: Steven Rostedt I love this patch. thanks, Steven :) -- 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/