* [PATCH] perf test: Ignore .scale and other special files @ 2016-06-06 14:36 Andi Kleen 2016-06-06 14:51 ` Arnaldo Carvalho de Melo 2016-06-08 8:38 ` [tip:perf/core] " tip-bot for Andi Kleen 0 siblings, 2 replies; 7+ messages in thread From: Andi Kleen @ 2016-06-06 14:36 UTC (permalink / raw) To: acme; +Cc: linux-kernel, jolsa, Andi Kleen From: Andi Kleen <ak@linux.intel.com> perf test tries to parse all entries in /sys/devices/cpu/events/. Ignore the special entries like '.scale', which cannot be directly parsed as an event. This patch assumes all files containing a '.' are special and can be ignored. Signed-off-by: Andi Kleen <ak@linux.intel.com> --- tools/perf/tests/parse-events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 7865f68dc0d8..b2a2c74136a5 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1783,8 +1783,8 @@ static int test_pmu_events(void) struct evlist_test e; char name[MAX_NAME]; - if (!strcmp(ent->d_name, ".") || - !strcmp(ent->d_name, "..")) + /* Names containing . are special and cannot be used directly */ + if (strchr(ent->d_name, '.')) continue; snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); -- 2.5.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] perf test: Ignore .scale and other special files 2016-06-06 14:36 [PATCH] perf test: Ignore .scale and other special files Andi Kleen @ 2016-06-06 14:51 ` Arnaldo Carvalho de Melo 2016-06-06 14:54 ` Arnaldo Carvalho de Melo 2016-06-08 8:38 ` [tip:perf/core] " tip-bot for Andi Kleen 1 sibling, 1 reply; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2016-06-06 14:51 UTC (permalink / raw) To: Andi Kleen; +Cc: linux-kernel, jolsa, Andi Kleen Em Mon, Jun 06, 2016 at 07:36:06AM -0700, Andi Kleen escreveu: > perf test tries to parse all entries in /sys/devices/cpu/events/. > Ignore the special entries like '.scale', which cannot be directly > parsed as an event. This patch assumes all files containing a '.' > are special and can be ignored. > +++ b/tools/perf/tests/parse-events.c > @@ -1783,8 +1783,8 @@ static int test_pmu_events(void) > - if (!strcmp(ent->d_name, ".") || > - !strcmp(ent->d_name, "..")) > + /* Names containing . are special and cannot be used directly */ > + if (strchr(ent->d_name, '.')) > continue; Ok, this is a more generic fix than the one I used here (adding: || strends(ent->d_name, ".scale"), I'll use yours, but this gets us to the following error: [root@jouet ~]# perf test -v 5 2>&1 | tail running test 49 'r1234/name=rawpmu/' running test 50 '4:0x6530160/name=numpmu/' running test 51 'L1-dcache-misses/name=cachepmu/' running test 0 'cpu/config=10,config1,config2=3,period=1000/u' running test 1 'cpu/config=1,name=krava/u,cpu/config=2/u' running test 2 'cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/' failed to parse event 'topdown-total-slots:u,cpu/event=topdown-total-slots/u', err 1 test child finished with 1 ---- end ---- parse events tests: FAILED! [root@jouet ~]# cat /sys/devices/cpu/events/topdown-total-slots event=0x3c,umask=0x0,any=1[root@jouet ~]# [root@jouet ~]# [root@jouet ~]# cat /sys/devices/cpu/events/bus-cycles event=0x3c,umask=0x01 [root@jouet ~]# I.e seems to be bickering about a missing newline in the sysfs entry, will check the parser... - Arnaldo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf test: Ignore .scale and other special files 2016-06-06 14:51 ` Arnaldo Carvalho de Melo @ 2016-06-06 14:54 ` Arnaldo Carvalho de Melo 2016-06-06 15:09 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2016-06-06 14:54 UTC (permalink / raw) To: Arnaldo Carvalho de Melo; +Cc: Andi Kleen, linux-kernel, jolsa, Andi Kleen Em Mon, Jun 06, 2016 at 11:51:48AM -0300, Arnaldo Carvalho de Melo escreveu: > But this gets us to the following error: > > [root@jouet ~]# perf test -v 5 2>&1 | tail > running test 49 'r1234/name=rawpmu/' > running test 50 '4:0x6530160/name=numpmu/' > running test 51 'L1-dcache-misses/name=cachepmu/' > running test 0 'cpu/config=10,config1,config2=3,period=1000/u' > running test 1 'cpu/config=1,name=krava/u,cpu/config=2/u' > running test 2 'cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/' > failed to parse event 'topdown-total-slots:u,cpu/event=topdown-total-slots/u', err 1 > test child finished with 1 > ---- end ---- > parse events tests: FAILED! > [root@jouet ~]# cat /sys/devices/cpu/events/topdown-total-slots > event=0x3c,umask=0x0,any=1[root@jouet ~]# > [root@jouet ~]# > [root@jouet ~]# cat /sys/devices/cpu/events/bus-cycles > event=0x3c,umask=0x01 > [root@jouet ~]# > > I.e seems to be bickering about a missing newline in the sysfs entry, will check the parser... Maybe something else, as there are other files there without the newline and the code introducing the topdown events doesn't look to be problematic in this regard... - Arnaldo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf test: Ignore .scale and other special files 2016-06-06 14:54 ` Arnaldo Carvalho de Melo @ 2016-06-06 15:09 ` Arnaldo Carvalho de Melo 2016-06-06 16:31 ` Andi Kleen 0 siblings, 1 reply; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2016-06-06 15:09 UTC (permalink / raw) To: Arnaldo Carvalho de Melo; +Cc: Andi Kleen, linux-kernel, jolsa, Andi Kleen Em Mon, Jun 06, 2016 at 11:54:58AM -0300, Arnaldo Carvalho de Melo escreveu: > Em Mon, Jun 06, 2016 at 11:51:48AM -0300, Arnaldo Carvalho de Melo escreveu: > > But this gets us to the following error: > > > > [root@jouet ~]# perf test -v 5 2>&1 | tail > > running test 49 'r1234/name=rawpmu/' > > running test 50 '4:0x6530160/name=numpmu/' > > running test 51 'L1-dcache-misses/name=cachepmu/' > > running test 0 'cpu/config=10,config1,config2=3,period=1000/u' > > running test 1 'cpu/config=1,name=krava/u,cpu/config=2/u' > > running test 2 'cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/' > > failed to parse event 'topdown-total-slots:u,cpu/event=topdown-total-slots/u', err 1 > > test child finished with 1 > > ---- end ---- > > parse events tests: FAILED! > > [root@jouet ~]# cat /sys/devices/cpu/events/topdown-total-slots > > event=0x3c,umask=0x0,any=1[root@jouet ~]# > > [root@jouet ~]# > > [root@jouet ~]# cat /sys/devices/cpu/events/bus-cycles > > event=0x3c,umask=0x01 > > [root@jouet ~]# > > > > I.e seems to be bickering about a missing newline in the sysfs entry, will check the parser... > > Maybe something else, as there are other files there without the newline > and the code introducing the topdown events doesn't look to be > problematic in this regard... [root@jouet ~]# perf stat -e cpu/topdown-total-slots/ usleep 1 Performance counter stats for 'usleep 1': 1,756,310 cpu/topdown-total-slots/ 0.000797426 seconds time elapsed [root@jouet ~]# perf stat -e cpu/topdown-total-slots/u usleep 1 Performance counter stats for 'usleep 1': 606,770 cpu/topdown-total-slots/u 0.000728467 seconds time elapsed [root@jouet ~]# perf stat -e cpu/event=topdown-total-slots/u usleep 1 Performance counter stats for 'usleep 1': 639,170 cpu/event=topdown-total-slots/u 0.000797547 seconds time elapsed [root@jouet ~]# Both work, i.e. unrestricted wrt kernel/user, user only (/u suffix), like in the test, it is just when we try: [root@jouet ~]# perf stat -e topdown-total-slots:u,cpu/event=topdown-total-slots/u usleep 1 event syntax error: 'topdown-total-slots:u,cpu/event=topdown-total-slots/u' \___ parser error Run 'perf list' for a list of valid events Usage: perf stat [<options>] [<command>] -e, --event <event> event selector. use 'perf list' to list available events [root@jouet ~]# that it fails, Jiri, probably something obvious to you? :-) - Arnaldo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf test: Ignore .scale and other special files 2016-06-06 15:09 ` Arnaldo Carvalho de Melo @ 2016-06-06 16:31 ` Andi Kleen 2016-06-06 19:56 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 7+ messages in thread From: Andi Kleen @ 2016-06-06 16:31 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo, Andi Kleen, linux-kernel, jolsa > [root@jouet ~]# perf stat -e topdown-total-slots:u,cpu/event=topdown-total-slots/u usleep 1 > event syntax error: 'topdown-total-slots:u,cpu/event=topdown-total-slots/u' > \___ parser error > Run 'perf list' for a list of valid events > > Usage: perf stat [<options>] [<command>] > > -e, --event <event> event selector. use 'perf list' to list available events > [root@jouet ~]# > > that it fails, Jiri, probably something obvious to you? :-) Works for me here ./perf stat -e topdown-total-slots:u,cpu/event=topdown-total-slots/u sleep 1 Performance counter stats for 'sleep 1': 515,204 topdown-total-slots:u 514,712 cpu/event=topdown-total-slots/u 1.001438114 seconds time elapsed Did you perhaps miss this hunk? --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -259,6 +259,7 @@ cycles-ct { return str(yyscanner, PE_KERNEL_PMU_EVENT); } cycles-t { return str(yyscanner, PE_KERNEL_PMU_EVENT); } mem-loads { return str(yyscanner, PE_KERNEL_PMU_EVENT); } mem-stores { return str(yyscanner, PE_KERNEL_PMU_EVENT); } +topdown-[a-z-]+ { return str(yyscanner, PE_KERN -Andi -- ak@linux.intel.com -- Speaking for myself only ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf test: Ignore .scale and other special files 2016-06-06 16:31 ` Andi Kleen @ 2016-06-06 19:56 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2016-06-06 19:56 UTC (permalink / raw) To: Andi Kleen; +Cc: Andi Kleen, linux-kernel, Jiri Olsa Em Mon, Jun 06, 2016 at 09:31:16AM -0700, Andi Kleen escreveu: > > [root@jouet ~]# perf stat -e topdown-total-slots:u,cpu/event=topdown-total-slots/u usleep 1 > > event syntax error: 'topdown-total-slots:u,cpu/event=topdown-total-slots/u' > > \___ parser error > > that it fails, Jiri, probably something obvious to you? :-) > Works for me here > > ./perf stat -e topdown-total-slots:u,cpu/event=topdown-total-slots/u sleep 1 > > Performance counter stats for 'sleep 1': > > 515,204 topdown-total-slots:u > 514,712 cpu/event=topdown-total-slots/u > > 1.001438114 seconds time elapsed > > Did you perhaps miss this hunk? Yeah, the build process seems to be buggy here, not noticing that change it seems not to have regenerated the .c files from that .l. After I removed the build dir and rebuilt everything, it works now, doing the docker-based lots-of-distros build now. - Arnaldo > --- a/tools/perf/util/parse-events.l > +++ b/tools/perf/util/parse-events.l > @@ -259,6 +259,7 @@ cycles-ct { return str(yyscanner, PE_KERNEL_PMU_EVENT); } > cycles-t { return str(yyscanner, PE_KERNEL_PMU_EVENT); } > mem-loads { return str(yyscanner, PE_KERNEL_PMU_EVENT); } > mem-stores { return str(yyscanner, PE_KERNEL_PMU_EVENT); } > +topdown-[a-z-]+ { return str(yyscanner, PE_KERN > > -Andi > -- > ak@linux.intel.com -- Speaking for myself only ^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:perf/core] perf test: Ignore .scale and other special files 2016-06-06 14:36 [PATCH] perf test: Ignore .scale and other special files Andi Kleen 2016-06-06 14:51 ` Arnaldo Carvalho de Melo @ 2016-06-08 8:38 ` tip-bot for Andi Kleen 1 sibling, 0 replies; 7+ messages in thread From: tip-bot for Andi Kleen @ 2016-06-08 8:38 UTC (permalink / raw) To: linux-tip-commits; +Cc: hpa, linux-kernel, ak, acme, tglx, mingo, jolsa Commit-ID: 17a2634bcb88e52bd637fdaa47d7ff0bddb0188f Gitweb: http://git.kernel.org/tip/17a2634bcb88e52bd637fdaa47d7ff0bddb0188f Author: Andi Kleen <ak@linux.intel.com> AuthorDate: Mon, 6 Jun 2016 07:36:06 -0700 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Mon, 6 Jun 2016 12:11:14 -0300 perf test: Ignore .scale and other special files 'perf test' tries to parse all entries in /sys/devices/cpu/events/. Ignore the special entries like '.scale', which cannot be directly parsed as an event. This patch assumes all files containing a '.' are special and can be ignored. Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/1465223766-29902-1-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/tests/parse-events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 7865f68..b2a2c74 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1783,8 +1783,8 @@ static int test_pmu_events(void) struct evlist_test e; char name[MAX_NAME]; - if (!strcmp(ent->d_name, ".") || - !strcmp(ent->d_name, "..")) + /* Names containing . are special and cannot be used directly */ + if (strchr(ent->d_name, '.')) continue; snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-06-08 8:38 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-06-06 14:36 [PATCH] perf test: Ignore .scale and other special files Andi Kleen 2016-06-06 14:51 ` Arnaldo Carvalho de Melo 2016-06-06 14:54 ` Arnaldo Carvalho de Melo 2016-06-06 15:09 ` Arnaldo Carvalho de Melo 2016-06-06 16:31 ` Andi Kleen 2016-06-06 19:56 ` Arnaldo Carvalho de Melo 2016-06-08 8:38 ` [tip:perf/core] " tip-bot for Andi Kleen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).