* [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file
@ 2016-11-29 20:39 David Ahern
2016-11-30 5:31 ` Namhyung Kim
2016-12-07 18:24 ` [tip:perf/core] " tip-bot for David Ahern
0 siblings, 2 replies; 5+ messages in thread
From: David Ahern @ 2016-11-29 20:39 UTC (permalink / raw)
To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern
Arnaldo reported an unhelpful error message when running perf sched
timehist on a file that did not contain sched tracepoints:
[root@jouet ~]# perf sched timehist
No trace sample to read. Did you call 'perf record -R'?
[root@jouet ~]# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
Change the has_traces check to look for the sched_switch event. Analysis
for perf sched timehist requires at least this event.
Now when analyzing a file without sched tracepoints you get:
root@f21-vbox:/tmp$ perf sched timehist
No sched_switch events found. Have you run 'perf sched record'?
Signed-off-by: David Ahern <dsahern@gmail.com>
---
tools/perf/builtin-sched.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 870d94cd20ba..84c39f177bef 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2629,8 +2629,12 @@ static int perf_sched__timehist(struct perf_sched *sched)
if (perf_session__set_tracepoints_handlers(session, handlers))
goto out;
- if (!perf_session__has_traces(session, "record -R"))
+ /* sched_switch event at a minimum needs to exist */
+ if (!perf_evlist__find_tracepoint_by_name(session->evlist,
+ "sched:sched_switch")) {
+ pr_err("No sched_switch events found. Have you run 'perf sched record'?\n");
goto out;
+ }
if (sched->show_migrations &&
perf_session__set_tracepoints_handlers(session, migrate_handlers))
--
2.7.4 (Apple Git-66)
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file
2016-11-29 20:39 [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file David Ahern
@ 2016-11-30 5:31 ` Namhyung Kim
2016-12-05 23:41 ` David Ahern
2016-12-07 18:24 ` [tip:perf/core] " tip-bot for David Ahern
1 sibling, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2016-11-30 5:31 UTC (permalink / raw)
To: David Ahern; +Cc: acme, mingo, peterz, jolsa, linux-kernel
On 11/30/16, David Ahern <dsahern@gmail.com> wrote:
> Arnaldo reported an unhelpful error message when running perf sched
> timehist on a file that did not contain sched tracepoints:
>
> [root@jouet ~]# perf sched timehist
> No trace sample to read. Did you call 'perf record -R'?
>
> [root@jouet ~]# perf evlist -v
> cycles:ppp: size: 112, { sample_period, sample_freq }: 4000,
> sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled: 1, inherit: 1,
> mmap: 1, comm: 1, freq: 1, task: 1, precise_ip: 3, sample_id_all: 1,
> exclude_guest: 1, mmap2: 1, comm_exec: 1
>
> Change the has_traces check to look for the sched_switch event. Analysis
> for perf sched timehist requires at least this event.
>
> Now when analyzing a file without sched tracepoints you get:
>
> root@f21-vbox:/tmp$ perf sched timehist
> No sched_switch events found. Have you run 'perf sched record'?
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> tools/perf/builtin-sched.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 870d94cd20ba..84c39f177bef 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -2629,8 +2629,12 @@ static int perf_sched__timehist(struct perf_sched
> *sched)
> if (perf_session__set_tracepoints_handlers(session, handlers))
> goto out;
>
> - if (!perf_session__has_traces(session, "record -R"))
> + /* sched_switch event at a minimum needs to exist */
> + if (!perf_evlist__find_tracepoint_by_name(session->evlist,
> + "sched:sched_switch")) {
> + pr_err("No sched_switch events found. Have you run 'perf sched
> record'?\n");
> goto out;
> + }
>
> if (sched->show_migrations &&
> perf_session__set_tracepoints_handlers(session, migrate_handlers))
> --
> 2.7.4 (Apple Git-66)
>
>
--
Thanks,
Namhyung Kim
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file
2016-11-30 5:31 ` Namhyung Kim
@ 2016-12-05 23:41 ` David Ahern
2016-12-06 16:14 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2016-12-05 23:41 UTC (permalink / raw)
To: Namhyung Kim, acme; +Cc: mingo, peterz, jolsa, linux-kernel
On 11/29/16 9:31 PM, Namhyung Kim wrote:
> On 11/30/16, David Ahern <dsahern@gmail.com> wrote:
>> Arnaldo reported an unhelpful error message when running perf sched
>> timehist on a file that did not contain sched tracepoints:
>>
>> [root@jouet ~]# perf sched timehist
>> No trace sample to read. Did you call 'perf record -R'?
>>
>> [root@jouet ~]# perf evlist -v
>> cycles:ppp: size: 112, { sample_period, sample_freq }: 4000,
>> sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled: 1, inherit: 1,
>> mmap: 1, comm: 1, freq: 1, task: 1, precise_ip: 3, sample_id_all: 1,
>> exclude_guest: 1, mmap2: 1, comm_exec: 1
>>
>> Change the has_traces check to look for the sched_switch event. Analysis
>> for perf sched timehist requires at least this event.
>>
>> Now when analyzing a file without sched tracepoints you get:
>>
>> root@f21-vbox:/tmp$ perf sched timehist
>> No sched_switch events found. Have you run 'perf sched record'?
>>
>> Signed-off-by: David Ahern <dsahern@gmail.com>
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> Thanks,
> Namhyung
>
Arnaldo: I think this one has been overlooked
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file
2016-12-05 23:41 ` David Ahern
@ 2016-12-06 16:14 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-06 16:14 UTC (permalink / raw)
To: David Ahern; +Cc: Namhyung Kim, mingo, peterz, jolsa, linux-kernel
Em Mon, Dec 05, 2016 at 03:41:54PM -0800, David Ahern escreveu:
> On 11/29/16 9:31 PM, Namhyung Kim wrote:
> > On 11/30/16, David Ahern <dsahern@gmail.com> wrote:
> >> Arnaldo reported an unhelpful error message when running perf sched
> >> timehist on a file that did not contain sched tracepoints:
> >> root@f21-vbox:/tmp$ perf sched timehist
> >> No sched_switch events found. Have you run 'perf sched record'?
> >>
> >> Signed-off-by: David Ahern <dsahern@gmail.com>
> >
> > Acked-by: Namhyung Kim <namhyung@kernel.org>
> >
> > Thanks,
> > Namhyung
> >
>
> Arnaldo: I think this one has been overlooked
Ooops, Reported-and-Forgot-by: Arnaldo, ok, tested, applied, thanks!
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perf/core] perf sched timehist: Improve error message when analyzing wrong file
2016-11-29 20:39 [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file David Ahern
2016-11-30 5:31 ` Namhyung Kim
@ 2016-12-07 18:24 ` tip-bot for David Ahern
1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for David Ahern @ 2016-12-07 18:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: peterz, namhyung, jolsa, mingo, linux-kernel, hpa, dsahern, tglx,
acme
Commit-ID: f45bf8d3939d8f32f06ec12e56d2b8651c5437b4
Gitweb: http://git.kernel.org/tip/f45bf8d3939d8f32f06ec12e56d2b8651c5437b4
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 29 Nov 2016 13:39:48 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 7 Dec 2016 12:00:32 -0300
perf sched timehist: Improve error message when analyzing wrong file
Arnaldo reported an unhelpful error message when running perf sched
timehist on a file that did not contain sched tracepoints:
[root@jouet ~]# perf sched timehist
No trace sample to read. Did you call 'perf record -R'?
[root@jouet ~]# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
Change the has_traces check to look for the sched_switch event. Analysis
for perf sched timehist requires at least this event.
Now when analyzing a file without sched tracepoints you get:
root@f21-vbox:/tmp$ perf sched timehist
No sched_switch events found. Have you run 'perf sched record'?
Signed-off-by: David Ahern <dsahern@gmail.com>
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1480451988-43673-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-sched.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 870d94c..84c39f1 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2629,8 +2629,12 @@ static int perf_sched__timehist(struct perf_sched *sched)
if (perf_session__set_tracepoints_handlers(session, handlers))
goto out;
- if (!perf_session__has_traces(session, "record -R"))
+ /* sched_switch event at a minimum needs to exist */
+ if (!perf_evlist__find_tracepoint_by_name(session->evlist,
+ "sched:sched_switch")) {
+ pr_err("No sched_switch events found. Have you run 'perf sched record'?\n");
goto out;
+ }
if (sched->show_migrations &&
perf_session__set_tracepoints_handlers(session, migrate_handlers))
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-07 18:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 20:39 [PATCH v2] perf sched timehist: Improve error message when analyzing wrong file David Ahern
2016-11-30 5:31 ` Namhyung Kim
2016-12-05 23:41 ` David Ahern
2016-12-06 16:14 ` Arnaldo Carvalho de Melo
2016-12-07 18:24 ` [tip:perf/core] " tip-bot for David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox