Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756608Ab0AMWNP (ORCPT ); Wed, 13 Jan 2010 17:13:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756368Ab0AMWNO (ORCPT ); Wed, 13 Jan 2010 17:13:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16987 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755540Ab0AMWNN (ORCPT ); Wed, 13 Jan 2010 17:13:13 -0500 Message-ID: <4B4E4551.2010302@redhat.com> Date: Wed, 13 Jan 2010 17:12:33 -0500 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-3.fc11 Thunderbird/3.0 MIME-Version: 1.0 To: rostedt@goodmis.org CC: Frederic Weisbecker , Srikar Dronamraju , Ingo Molnar , Arnaldo Carvalho de Melo , Peter Zijlstra , Ananth N Mavinakayanahalli , utrace-devel , Jim Keniston , Maneesh Soni , Mark Wielaard , LKML Subject: Re: [RFC] [PATCH 7/7] Ftrace plugin for Uprobes References: <20100111122521.22050.3654.sendpatchset@srikar.in.ibm.com> <20100111122608.22050.94088.sendpatchset@srikar.in.ibm.com> <20100112045454.GJ5243@nowhere> <1263272933.28171.3804.camel@gandalf.stny.rr.com> <4B4E41FF.4020800@redhat.com> In-Reply-To: <4B4E41FF.4020800@redhat.com> X-Enigmail-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1603 Lines: 57 Masami Hiramatsu wrote: > Steven Rostedt wrote: >> On Tue, 2010-01-12 at 05:54 +0100, Frederic Weisbecker wrote: >> >>> Now what if I want to launch ls and want to profile a function >>> inside. What can I do with a trace event. I can't create the >>> probe event based on a pid as I don't know it in advance. >>> I could give it the ls cmdline and it manages to activate >>> on the next ls launched. This is racy as another ls can >>> be launched concurrently. >> >> You make a wrapper script: >> >> #!/bin/sh >> $$ >> exec $* >> >> I do this all the time to limit the function tracer to a specific app. >> >> #!/bin/sh >> echo $$ > /debug/tracing/set_ftrace_pid >> echo function > /debug/tracing/current_tracer >> exec $* > > I recommend you to add below line at the end of the script, > from my experience. :) > > echo nop > /debug/tracing/current_tracer Oops, my bad, it doesn't work after exec... But, it is very important to disable function tracer after tracing target process. So, perhaps, below script may work. #!/bin/sh (echo $BASHPID > /debug/tracing/set_ftrace_pid echo function > /debug/tracing/current_tracer exec $*) echo nop > /debug/tracing/current_tracer Thanks, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com -- 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/