From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932629AbbENOcO (ORCPT ); Thu, 14 May 2015 10:32:14 -0400 Received: from smtprelay0034.hostedemail.com ([216.40.44.34]:33944 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932091AbbENOcM (ORCPT ); Thu, 14 May 2015 10:32:12 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:1801:2198:2199:2393:2553:2559:2562:2693:2895:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4605:5007:6119:6248:6261:6299:7875:7903:9040:10004:10848:10967:11026:11232:11473:11658:11914:12043:12050:12296:12438:12517:12519:12555:12740:14096:14097:21060:21067:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: geese93_8763df5790d0e X-Filterd-Recvd-Size: 5017 Date: Thu, 14 May 2015 10:32:09 -0400 From: Steven Rostedt To: Yoshihiro YUNOMAE Cc: Ian Webster , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] trace-cmd: Add record --clock option to specify a trace clock Message-ID: <20150514103209.43314e02@gandalf.local.home> In-Reply-To: <52AE7D4C.2000101@hitachi.com> References: <20131211190832.GA8513@planetaryresources.com> <20131211142639.09527db9@gandalf.local.home> <20131212233024.GA8669@planetaryresources.com> <52AE7D4C.2000101@hitachi.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Dec 2013 13:10:52 +0900 Yoshihiro YUNOMAE wrote: > Hi Ian, > > (2013/12/13 8:30), Ian Webster wrote: > > This change adds a --clock option to trace-cmd record. It simply writes > > trace_clock on debugfs. Examples of valid choices on most systems are: local, > > global, counter, and any other choice compatible with ftrace. > > Nice work! > Please see my following comments. Hmm, I was waiting for a reply back with an update against these comments and never saw one. I eventually forgot about this patch :-( I went to add it now, and noticed that I already added a -C option for trace-clock which also works for instances. Sorry about forgetting about this patch (just found it buried in my inbox). I'll be releasing 2.6 soon, with a bunch of new updates. -- Steve > > > This complements Yoshihiro Yunomae's change 8c9867c (trace-cmd: Add support for > > extracting trace_clock in report). > > > > Signed-off-by: Ian Webster > > > > --- > > Changes per Steven's comments: > > * add missing const > > * preserve tab whitespace > > > > Documentation/trace-cmd-record.1.txt | 5 +++++ > > trace-record.c | 19 +++++++++++++++++++ > > trace-usage.c | 1 + > > 3 files changed, 25 insertions(+) > > > > diff --git a/Documentation/trace-cmd-record.1.txt b/Documentation/trace-cmd-record.1.txt > > index 832a257..5e83454 100644 > > --- a/Documentation/trace-cmd-record.1.txt > > +++ b/Documentation/trace-cmd-record.1.txt > > @@ -240,6 +240,11 @@ OPTIONS > > timestamp to gettimeofday which will allow wall time output from the > > timestamps reading the created 'trace.dat' file. > > > > +*--clock* 'clock_name':: > > + When an event is recorded into the ring buffer, a timestamp is added. This > > + stamp comes from the specified clock. Ftrace uses the "local" clock by > > + default. Other common clocks include: global, counter, uptime, perf, x86-tsc. > > + > > EXAMPLES > > -------- > > > > diff --git a/trace-record.c b/trace-record.c > > index 0199627..2143080 100644 > > --- a/trace-record.c > > +++ b/trace-record.c > > @@ -399,6 +399,20 @@ static int set_ftrace(int set, int use_proc) > > return 0; > > } > > > > +static void set_trace_clock(const char *clock_choice) > > +{ > > + FILE *fp; > > + char *path; > > + > > + path = tracecmd_get_tracing_file("trace_clock"); > > + fp = fopen(path, "w"); > > + if (!fp) > > + die("writing to '%s'", path); > > + tracecmd_put_tracing_file(path); > > + fwrite(clock_choice, 1, strlen(clock_choice), fp); > > Please add an error check for fwrite(). If clock_choice is invalid, > trace-cmd would better output the error report and die. > > > + fclose(fp); > > +} > > + > > static char * > > get_instance_file(struct buffer_instance *instance, const char *file) > > { > > @@ -2279,6 +2293,7 @@ static void record_all_events(void) > > } > > > > enum { > > + OPT_clock = 252, > > OPT_nosplice = 253, > > OPT_funcstack = 254, > > OPT_date = 255, > > @@ -2351,6 +2366,7 @@ void trace_record (int argc, char **argv) > > {"func-stack", no_argument, NULL, OPT_funcstack}, > > {"nosplice", no_argument, NULL, OPT_nosplice}, > > {"help", no_argument, NULL, '?'}, > > + {"clock", required_argument, NULL, OPT_clock}, > > {NULL, 0, NULL, 0} > > }; > > > > @@ -2530,6 +2546,9 @@ void trace_record (int argc, char **argv) > > case OPT_nosplice: > > recorder_flags |= TRACECMD_RECORD_NOSPLICE; > > break; > > + case OPT_clock: > > + set_trace_clock(optarg); > > + break; > > This implementation does not support multiple buffers. > trace_clock had better be changed after sub-buffers are created, I > think. > > Example: > trace-cmd record -e sched --clock local -B foo -e block --clock x86-tsc > > Thanks, > Yoshihiro YUNOMAE >