[PATCH 02/15] perf test: Make the rdpmc test honour 'verbose' mode

From: Arnaldo Carvalho de Melo
Date: Wed May 02 2012 - 15:27:31 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

It was unconditionally printing debug stuff when in non -v mode we
should just print the name and result of the test.

Now:

[root@sandy ~]# perf test rdpmc
6: x86 rdpmc test: Ok
[root@sandy ~]# perf test -v rdpmc
6: x86 rdpmc test:
--- start ---
0: 6030
1: 60030
2: 600050
3: 6000056
4: 60000070
5: 600000266
---- end ----
x86 rdpmc test: Ok
[root@sandy ~]#

Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Link: http://lkml.kernel.org/n/tip-0tjedaozsy9oarq30nvzg74b@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/builtin-test.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 1c5b980..5502a4a 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1549,8 +1549,6 @@ static int __test__rdpmc(void)
sa.sa_sigaction = segfault_handler;
sigaction(SIGSEGV, &sa, NULL);

- fprintf(stderr, "\n\n");
-
fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
if (fd < 0) {
die("Error: sys_perf_event_open() syscall returned "
@@ -1575,7 +1573,7 @@ static int __test__rdpmc(void)
loops *= 10;

delta = now - stamp;
- fprintf(stderr, "%14d: %14Lu\n", n, (long long)delta);
+ pr_debug("%14d: %14Lu\n", n, (long long)delta);

delta_sum += delta;
}
@@ -1583,7 +1581,7 @@ static int __test__rdpmc(void)
munmap(addr, page_size);
close(fd);

- fprintf(stderr, " ");
+ pr_debug(" ");

if (!delta_sum)
return -1;
--
1.7.9.2.358.g22243

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/