Re: [PATCH 31/52] perf stat record: Synthesize stat record data

From: Arnaldo Carvalho de Melo
Date: Tue Oct 27 2015 - 10:42:56 EST


Em Sun, Oct 25, 2015 at 03:51:47PM +0100, Jiri Olsa escreveu:
> Synthesizing needed stat record data for report/script:
> - cpu/thread maps
> - stat config

After this it gets a bit better, but then I expected that to specify an
event I would be able to use:

[root@zoo linux]# perf stat record -e cycles usleep 1
Error: unknown switch `e'

Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]

-o, --output <file> output file name


But I need to do it as:

[root@zoo linux]# perf stat -e cycles record usleep 1

Performance counter stats for 'usleep 1':

948417 cycles

0.000749965 seconds time elapsed

[root@zoo linux]#

--------------------------------------------------

This is confusing...

Anyway, now the perf.data file doesn't produce that many confusing
messages, just one, and the error reporting continues needing a
newline, oops just noticed another problem:

[root@zoo linux]# perf stat record usleep 1

Performance counter stats for 'usleep 1':

0.520959 task-clock (msec) # 0.504 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
51 page-faults # 0.098 M/sec
929738 cycles # 1.785 GHz
625885 stalled-cycles-frontend # 67.32% frontend cycles idle
<not supported> stalled-cycles-backend
634514 instructions # 0.68 insns per cycle
# 0.99 stalled cycles per insn
128859 branches # 247.350 M/sec
7602 branch-misses # 5.90% of all branches

0.001034675 seconds time elapsed

[root@zoo linux]# perf evlist
non matching sample_type[root@zoo linux]#

But, if I specify an event:

[root@zoo linux]# perf stat -e cycles record usleep 1

Performance counter stats for 'usleep 1':

876987 cycles

0.001285050 seconds time elapsed

[root@zoo linux]# perf evlist
cycles
[root@zoo linux]# perf evlist -v
cycles: size: 112, read_format: TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING, disabled: 1, inherit: 1, enable_on_exec: 1, exclude_guest: 1
[root@zoo linux]#

-------------------------

It then works as expected, lists the event collected, no confusing message
about 'sample_type' stuff is emitted.

Ditto for 'perf report'

[root@zoo linux]# perf report --stdio
Warning:
Kernel address maps (/proc/{kallsyms,modules}) were restricted.

Check /proc/sys/kernel/kptr_restrict before running 'perf record'.

As no suitable kallsyms nor vmlinux was found, kernel samples
can't be resolved.

Samples in kernel modules can't be resolved as well.

Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
[root@zoo linux]#

------------------------------------------------

I.e. when I explicitely state what events should be collected, it behaves
nicely, modulo this message about kernel address maps being restricted in
'report', so it looks like just some fix is needed to make it work like that
when no events are specified.

So, I'm creating a perf/stat branch and putting what I processed so far, with
the changelog edits and changes in some function/struct names I
partially mentioned, please try to continue from there, ok?

- Arnaldo
--
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/