Re: [PATCH] perf, record: Add clockid parameter

2015-03-31 Thread Peter Zijlstra
On Mon, Mar 30, 2015 at 01:41:12PM -0600, David Ahern wrote: > On 3/30/15 1:33 PM, Peter Zijlstra wrote: > >On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: > >>This works but the result is not always intuitive as to why it failed. > >> > >>On a kernel that does not support the clock

Re: [PATCH] perf, record: Add clockid parameter

2015-03-31 Thread Peter Zijlstra
On Mon, Mar 30, 2015 at 01:41:12PM -0600, David Ahern wrote: On 3/30/15 1:33 PM, Peter Zijlstra wrote: On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: This works but the result is not always intuitive as to why it failed. On a kernel that does not support the clock id you get:

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 1:34 PM, Peter Zijlstra wrote: 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

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Stephane Eranian
On Mon, Mar 30, 2015 at 12:41 PM, David Ahern wrote: > On 3/30/15 1:33 PM, Peter Zijlstra wrote: >> >> On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: >>> >>> This works but the result is not always intuitive as to why it failed. >>> >>> On a kernel that does not support the clock id

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 1:33 PM, Peter Zijlstra wrote: On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: This works but the result is not always intuitive as to why it failed. On a kernel that does not support the clock id you get: $ perf sched record -k mono -- sleep 1 Error:

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 1:32 PM, Peter Zijlstra wrote: --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -732,13 +732,16 @@ static const struct clockid_map clockids /* available for all events, NMI safe */ CLOCKID_MAP("monotonic", CLOCK_MONOTONIC),

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
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) { >

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Mon, Mar 30, 2015 at 11:17:22AM -0600, David Ahern wrote: > On 3/30/15 3:17 AM, Peter Zijlstra wrote: > >I did this on top.. > > > >--- a/tools/perf/builtin-record.c > >+++ b/tools/perf/builtin-record.c > >@@ -732,13 +732,16 @@ static const struct clockid_map clockids > > /* available for

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: > This works but the result is not always intuitive as to why it failed. > > On a kernel that does not support the clock id you get: > $ perf sched record -k mono -- sleep 1 > Error: > clockid not supported. > > And on a

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
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

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/28/15 1:55 AM, Peter Zijlstra wrote: @@ -1085,6 +1093,8 @@ static int __perf_evsel__open(struct per } fallback_missing_features: + if (perf_missing_features.clockid) + evsel->attr.use_clockid = 0; if (perf_missing_features.cloexec)

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 3:17 AM, Peter Zijlstra wrote: I did this on top.. --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -732,13 +732,16 @@ static const struct clockid_map clockids /* available for all events, NMI safe */ CLOCKID_MAP("monotonic", CLOCK_MONOTONIC),

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 2:24 AM, Peter Zijlstra wrote: I am clearly missing some kernel patch to try out this perf patch. I have the 4 timekeeper ones; none of those modify perf_event code. What other patches are needed? Was this one (or some variant) accepted: https://lkml.org/lkml/2015/2/20/236

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Sat, Mar 28, 2015 at 08:55:49AM +0100, Peter Zijlstra wrote: > +static const struct clockid_map clockids[] = { > + /* available for all events, NMI safe */ > + CLOCKID_MAP("monotonic", CLOCK_MONOTONIC), > + CLOCKID_MAP("monotonic_raw", CLOCK_MONOTONIC_RAW), > +

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Sun, Mar 29, 2015 at 07:00:19PM -0600, David Ahern wrote: > On 3/28/15 1:55 AM, Peter Zijlstra wrote: > >Subject: perf, record: Add clockid parameter > >From: Peter Zijlstra > >Date: Fri, 27 Mar 2015 15:32:01 +0100 > > > >Teach perf-record about the new perf_event_attr::{use_clockid, clockid}

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Sun, Mar 29, 2015 at 07:00:19PM -0600, David Ahern wrote: On 3/28/15 1:55 AM, Peter Zijlstra wrote: Subject: perf, record: Add clockid parameter From: Peter Zijlstra pet...@infradead.org Date: Fri, 27 Mar 2015 15:32:01 +0100 Teach perf-record about the new perf_event_attr::{use_clockid,

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Sat, Mar 28, 2015 at 08:55:49AM +0100, Peter Zijlstra wrote: +static const struct clockid_map clockids[] = { + /* available for all events, NMI safe */ + CLOCKID_MAP(monotonic, CLOCK_MONOTONIC), + CLOCKID_MAP(monotonic_raw, CLOCK_MONOTONIC_RAW), + CLOCKID_MAP(raw,

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 3:17 AM, Peter Zijlstra wrote: I did this on top.. --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -732,13 +732,16 @@ static const struct clockid_map clockids /* available for all events, NMI safe */ CLOCKID_MAP(monotonic, CLOCK_MONOTONIC),

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/28/15 1:55 AM, Peter Zijlstra wrote: @@ -1085,6 +1093,8 @@ static int __perf_evsel__open(struct per } fallback_missing_features: + if (perf_missing_features.clockid) + evsel-attr.use_clockid = 0; if (perf_missing_features.cloexec) flags

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
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 =

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 2:24 AM, Peter Zijlstra wrote: I am clearly missing some kernel patch to try out this perf patch. I have the 4 timekeeper ones; none of those modify perf_event code. What other patches are needed? Was this one (or some variant) accepted: https://lkml.org/lkml/2015/2/20/236

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
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) { +

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 1:33 PM, Peter Zijlstra wrote: On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: This works but the result is not always intuitive as to why it failed. On a kernel that does not support the clock id you get: $ perf sched record -k mono -- sleep 1 Error:

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 1:32 PM, Peter Zijlstra wrote: --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -732,13 +732,16 @@ static const struct clockid_map clockids /* available for all events, NMI safe */ CLOCKID_MAP(monotonic, CLOCK_MONOTONIC),

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread David Ahern
On 3/30/15 1:34 PM, Peter Zijlstra wrote: 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

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Mon, Mar 30, 2015 at 11:17:22AM -0600, David Ahern wrote: On 3/30/15 3:17 AM, Peter Zijlstra wrote: I did this on top.. --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -732,13 +732,16 @@ static const struct clockid_map clockids /* available for all events,

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Peter Zijlstra
On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: This works but the result is not always intuitive as to why it failed. On a kernel that does not support the clock id you get: $ perf sched record -k mono -- sleep 1 Error: clockid not supported. And on a kernel

Re: [PATCH] perf, record: Add clockid parameter

2015-03-30 Thread Stephane Eranian
On Mon, Mar 30, 2015 at 12:41 PM, David Ahern dsah...@gmail.com wrote: On 3/30/15 1:33 PM, Peter Zijlstra wrote: On Mon, Mar 30, 2015 at 11:24:12AM -0600, David Ahern wrote: This works but the result is not always intuitive as to why it failed. On a kernel that does not support the clock id

Re: [PATCH] perf, record: Add clockid parameter

2015-03-29 Thread David Ahern
On 3/28/15 1:55 AM, Peter Zijlstra wrote: Subject: perf, record: Add clockid parameter From: Peter Zijlstra Date: Fri, 27 Mar 2015 15:32:01 +0100 Teach perf-record about the new perf_event_attr::{use_clockid, clockid} fields. Add a simple parameter to set the clock (if any) to be used for the

Re: [PATCH] perf, record: Add clockid parameter

2015-03-29 Thread David Ahern
On 3/28/15 1:55 AM, Peter Zijlstra wrote: Subject: perf, record: Add clockid parameter From: Peter Zijlstra pet...@infradead.org Date: Fri, 27 Mar 2015 15:32:01 +0100 Teach perf-record about the new perf_event_attr::{use_clockid, clockid} fields. Add a simple parameter to set the clock (if any)

Re: [PATCH] perf, record: Add clockid parameter

2015-03-28 Thread Peter Zijlstra
On Fri, Mar 27, 2015 at 03:37:47PM -0700, Stephane Eranian wrote: > > + OPT_INTEGER('k', "clockid", , > > + "clockid to use for events"), > > I think you'd want a symbolic name for the clock to make this easier > on the user. Sure, here goes. -- Subject: perf, record:

Re: [PATCH] perf, record: Add clockid parameter

2015-03-28 Thread Peter Zijlstra
On Fri, Mar 27, 2015 at 03:37:47PM -0700, Stephane Eranian wrote: + OPT_INTEGER('k', clockid, record.opts.clockid, + clockid to use for events), I think you'd want a symbolic name for the clock to make this easier on the user. Sure, here goes. -- Subject: perf,

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Stephane Eranian
On Fri, Mar 27, 2015 at 1:15 PM, Arnaldo Carvalho de Melo wrote: > Em Fri, Mar 27, 2015 at 11:35:25AM -0600, David Ahern escreveu: >> On 3/27/15 11:20 AM, Peter Zijlstra wrote: >> >>This is a new feature which means use_clockid on older kernels will fail. >> >>So >> >>need to catch that and

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Arnaldo Carvalho de Melo
Em Fri, Mar 27, 2015 at 11:35:25AM -0600, David Ahern escreveu: > On 3/27/15 11:20 AM, Peter Zijlstra wrote: > >>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?

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Stephane Eranian
On Fri, Mar 27, 2015 at 2:59 PM, Peter Zijlstra wrote: > On Fri, Mar 27, 2015 at 05:15:34PM -0300, Arnaldo Carvalho de Melo wrote: >> I.e. we're back to the sys_perf_event_open() error reporting suckz rockz >> thing, this time with PeterZ trying to find a way to avoid getting back >> to that

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Peter Zijlstra
On Fri, Mar 27, 2015 at 05:15:34PM -0300, Arnaldo Carvalho de Melo wrote: > I.e. we're back to the sys_perf_event_open() error reporting suckz rockz > thing, this time with PeterZ trying to find a way to avoid getting back > to that discussion... /me runz... ;-P :-) Not entirely, its just that

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread David Ahern
On 3/27/15 11:20 AM, Peter Zijlstra wrote: 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

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Peter Zijlstra
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 ---

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread David Ahern
On 3/27/15 8:32 AM, Peter Zijlstra wrote: On Fri, Mar 27, 2015 at 04:48:08AM -0700, tip-bot for Peter Zijlstra wrote: perf: Add per event clockid support And here the accompanying userspace; which I'd totally forgotten about. XXX: do we want to store the clockid in the data file as well,

[PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Peter Zijlstra
On Fri, Mar 27, 2015 at 04:48:08AM -0700, tip-bot for Peter Zijlstra wrote: > perf: Add per event clockid support And here the accompanying userspace; which I'd totally forgotten about. XXX: do we want to store the clockid in the data file as well, such that we can verify at perf-inject time the

[PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Peter Zijlstra
On Fri, Mar 27, 2015 at 04:48:08AM -0700, tip-bot for Peter Zijlstra wrote: perf: Add per event clockid support And here the accompanying userspace; which I'd totally forgotten about. XXX: do we want to store the clockid in the data file as well, such that we can verify at perf-inject time the

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Peter Zijlstra
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 ---

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread David Ahern
On 3/27/15 8:32 AM, Peter Zijlstra wrote: On Fri, Mar 27, 2015 at 04:48:08AM -0700, tip-bot for Peter Zijlstra wrote: perf: Add per event clockid support And here the accompanying userspace; which I'd totally forgotten about. XXX: do we want to store the clockid in the data file as well,

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread David Ahern
On 3/27/15 11:20 AM, Peter Zijlstra wrote: 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

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Peter Zijlstra
On Fri, Mar 27, 2015 at 05:15:34PM -0300, Arnaldo Carvalho de Melo wrote: I.e. we're back to the sys_perf_event_open() error reporting suckz rockz thing, this time with PeterZ trying to find a way to avoid getting back to that discussion... /me runz... ;-P :-) Not entirely, its just that I've

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Stephane Eranian
On Fri, Mar 27, 2015 at 2:59 PM, Peter Zijlstra pet...@infradead.org wrote: On Fri, Mar 27, 2015 at 05:15:34PM -0300, Arnaldo Carvalho de Melo wrote: I.e. we're back to the sys_perf_event_open() error reporting suckz rockz thing, this time with PeterZ trying to find a way to avoid getting back

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Arnaldo Carvalho de Melo
Em Fri, Mar 27, 2015 at 11:35:25AM -0600, David Ahern escreveu: On 3/27/15 11:20 AM, Peter Zijlstra wrote: 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

Re: [PATCH] perf, record: Add clockid parameter

2015-03-27 Thread Stephane Eranian
On Fri, Mar 27, 2015 at 1:15 PM, Arnaldo Carvalho de Melo a...@redhat.com wrote: Em Fri, Mar 27, 2015 at 11:35:25AM -0600, David Ahern escreveu: On 3/27/15 11:20 AM, Peter Zijlstra wrote: This is a new feature which means use_clockid on older kernels will fail. So need to catch that and