Re: [PATCH 1/3] perf tools: Record total sampling time

From: Ingo Molnar
Date: Mon Dec 02 2013 - 07:57:24 EST



So basically, in the end I think it should be possible to have the
following behavior:

perf record -a -e cycles sleep 1

perf report stat # Reports as if we ran: 'perf stat -a -e cycles sleep 1'
perf report # Reports the usual histogram

perf report --stat # Reports the perf stat output and the histogram

or so.

i.e. a perf.data file would by default always carry enough information
to enable the extraction of the 'perf stat' data.

At that point visualizing it is purely report-time logic, it does not
need any record-time options.

This would work for multi-event sampling as well, if we do:

perf record -a -e cycles -e branches sleep 1

then 'perf report stat' would output the same as:

$ perf stat -e cycles -e branches -a sleep 1

Performance counter stats for 'system wide':

34,174,518 cycles [100.00%]
3,155,677 branches

1.000802852 seconds time elapsed

Another neat feature this kind of workflo enables is the integration
of --repeat to perf record, so something like:

perf record --repeat 3 -a -e cycles -e branches sleep 1

would save 3 samples after each other, and would allow extraction of
the statistical stability of the measurement, and 'perf report stat'
would print the same result as a raw perf stat run would:

$ perf stat --repeat 3 -e cycles -e branches -e instructions -a sleep 1

Performance counter stats for 'system wide' (3 runs):

28,975,150,642 cycles ( +- 0.43% ) [100.00%]
10,740,235,371 branches ( +- 0.47% ) [100.00%]
44,535,464,754 instructions # 1.54 insns per cycle ( +- 0.47% )

1.005718027 seconds time elapsed ( +- 0.43% )

Or something like that. At that point we share reporting between perf
stat and perf report, no special ad-hoc options are needed to just
measure and report timestamps, it would all be a 'natural' side effect
of having perf stat.

What do you think?

Thanks,

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