lkml.org 
[lkml]   [2015]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf, record: Add clockid parameter
On Mon, Mar 30, 2015 at 11:33:42AM -0600, David Ahern wrote:
> 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;
> }

No, we must not have a !0 value in ->clockid when we do not set
use_clockid. The kernel checks for nonzero tail values.


\
 
 \ /
  Last update: 2015-03-30 22:01    [W:0.615 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site