lkml.org 
[lkml]   [2015]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] perf, record: Add clockid parameter
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.


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