Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751878AbaBMO0r (ORCPT ); Thu, 13 Feb 2014 09:26:47 -0500 Received: from mail-we0-f176.google.com ([74.125.82.176]:40109 "EHLO mail-we0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751414AbaBMO0q (ORCPT ); Thu, 13 Feb 2014 09:26:46 -0500 Date: Thu, 13 Feb 2014 15:26:42 +0100 From: Frederic Weisbecker To: Steven Rostedt Cc: LKML , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Johannes Berg , Andrew Morton , Wolfgang Grandegger Subject: Re: [RFC - beta][PATCH] tracing: Introduce TRACE_MARKER() no argument trace event Message-ID: <20140213142640.GD14383@localhost.localdomain> References: <20140207112357.35552998@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140207112357.35552998@gandalf.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 07, 2014 at 11:23:57AM -0500, Steven Rostedt wrote: > A while back ago, Wolfgang (and others) have asked about the ability to > add a trace event that recorder no data other than the fact that the > trace event was hit. > > I've been reluctant to do so, but I noticed that one already exists in > the iwlwifi tracepoints (iwlwifi_dev_irq) where it does a wasteful: > > /* TP_printk("") doesn't compile */ > TP_printk("%d", 0) > > The reason this is wasteful, is that there's a lot of code generated by > the TRACE_EVENT() macros that end up basically being nops. > > I figured I would instead create a TRACE_MARKER(name, print) that would > be something like: > > Added to tracepoint header: > > TRACE_MARKER(tpname, "Show this message"); > > Then you have: > > trace_tpname(); > > in the code. > > Notice that the tracepoint function (trace_()) has no arguments. > That's because the message is stored in the tracepoint (in one place) > and is printed when the tracepoint is read. That is, the message isn't > even recorded in the ring buffer. > > It still shows up in the tracepoint format file: > > name: tpname > ID: 281 > format: > field:unsigned short common_type; offset:0; size:2; signed:0; > field:unsigned char common_flags; offset:2; size:1; signed:0; > field:unsigned char common_preempt_count; offset:3; size:1; signed:0; > field:int common_pid; offset:4; size:4; signed:1; > > > print fmt: "Show this message" > > The TRACE_MARKER() is basically an optimized version of TRACE_EVENT() > with no arguments. It can be enabled and disabled the same way as any > other event, and stays within the system it was created in. > > Is this worth doing? It sounds worth yeah. I've run into this situation multiple times where I had to pass 0 instead of nothing on a tracepoint. Now about the name, why not TRACE_EVENT_EMPTY? Thanks. -- 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/