From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030213AbbC0RVN (ORCPT ); Fri, 27 Mar 2015 13:21:13 -0400 Received: from casper.infradead.org ([85.118.1.10]:43107 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbbC0RVK (ORCPT ); Fri, 27 Mar 2015 13:21:10 -0400 Date: Fri, 27 Mar 2015 18:20:59 +0100 From: Peter Zijlstra To: David Ahern Cc: tglx@linutronix.de, acme@redhat.com, jolsa@redhat.com, eranian@google.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, john.stultz@linaro.org, hpa@zytor.com, akpm@linux-foundation.org, mingo@kernel.org Subject: Re: [PATCH] perf, record: Add clockid parameter Message-ID: <20150327172059.GK23123@twins.programming.kicks-ass.net> References: <20150327143201.GG21418@twins.programming.kicks-ass.net> <55158F25.9040100@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55158F25.9040100@gmail.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2015 at 11:11:01AM -0600, David Ahern wrote: > > tools/perf/builtin-record.c | 3 +++ > > tools/perf/perf.h | 1 + > > tools/perf/util/evsel.c | 5 +++++ > > 3 files changed, 9 insertions(+) > > missing Documentation/perf-record.txt update --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -250,6 +250,11 @@ is off by default. --running-time:: Record running and enabled time for read events (:S) +-k:: +--clockid:: +Sets the clock id to use for the various time fields in the perf_event_type +records. See clock_gettime(). + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-list[1] > >+++ b/tools/perf/util/evsel.c > >@@ -761,6 +761,11 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) > > attr->disabled = 0; > > attr->enable_on_exec = 0; > > } > >+ > >+ if (opts->clockid >= 0) { > >+ attr->use_clockid = 1; > >+ attr->clockid = opts->clockid; > >+ } > > } > > > > static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) > > > > This is a new feature which means use_clockid on older kernels will fail. So > need to catch that and throw an error -- perhaps yet another probe function. How does that work? What do I grep to find an example? I figured if the kernel didn't support the syscall will fail and we'll terminate someplace. > Also, if the intent is to allow clock selection per event should there be an > event modifier as well (see get_event_modifier())? Nah, its not generally useful to mix clocks in a single recording. That gets real confused real quick on when which event happened. The per event configurability is handy to allow different (concurrent) records different settings.