From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753386AbbC3Rdp (ORCPT ); Mon, 30 Mar 2015 13:33:45 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:36478 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753044AbbC3Rdo (ORCPT ); Mon, 30 Mar 2015 13:33:44 -0400 Message-ID: <551988F6.8000501@gmail.com> Date: Mon, 30 Mar 2015 11:33:42 -0600 From: David Ahern User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Peter Zijlstra , Stephane Eranian CC: Arnaldo Carvalho de Melo , Thomas Gleixner , Jiri Olsa , Linus Torvalds , LKML , John Stultz , "H. Peter Anvin" , Andrew Morton , Ingo Molnar Subject: Re: [PATCH] perf, record: Add clockid parameter References: <20150327143201.GG21418@twins.programming.kicks-ass.net> <55158F25.9040100@gmail.com> <20150327172059.GK23123@twins.programming.kicks-ass.net> <551594DD.7050705@gmail.com> <20150327201534.GD6291@redhat.com> <20150327215942.GL23123@twins.programming.kicks-ass.net> <20150328075549.GG27490@worktop.programming.kicks-ass.net> In-Reply-To: <20150328075549.GG27490@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/28/15 1:55 AM, Peter Zijlstra wrote: > @@ -761,6 +762,11 @@ void perf_evsel__config(struct perf_evse > attr->disabled = 0; > attr->enable_on_exec = 0; > } > + > + if (opts->clockid >= 0) { > + attr->use_clockid = 1; > + attr->clockid = opts->clockid; > + } > } One more: you need to set attr->clockid to -1 if use_clockid is not set so that the analysis side knows whether attr->clockid was used. Otherwise it defaults to 0 == CLOCK_REALTIME which is misleading. diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1abf6919b8a2..27679ab38511 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -766,7 +766,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) if (opts->clockid >= 0) { attr->use_clockid = 1; attr->clockid = opts->clockid; - } + } else + attr->clockid = -1; } Dumping the setting in the header is useful as well: diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index fb432153e2aa..40bc8d010fcb 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1098,6 +1098,7 @@ static void print_event_desc(struct perf_header *ph, int fd, FILE *fp) } fprintf(fp, " }"); } + fprintf(fp, ", clockid = %d", evsel->attr.clockid); fputc('\n', fp); }