Re: [GIT PULL 00/43] perf/core new feature: 'perf stat record/report'

From: Ingo Molnar
Date: Fri Dec 18 2015 - 03:55:50 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

>
> * Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
>
> > From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> >
> > Hi Ingo,
> >
> > Please consider pulling, cool new feature! This is on top of the
> > perf-core-for-mingo-2.1 tag, with that RHEL6.7 bugfix, I had also to go
> > over this one fixing stuff in many spots :-\
> >
> > - Arnaldo
> >
> > The following changes since commit 1843b4e057b7717db21a3ad96fa16d6b4ee8f6c4:
> >
> > tools subcmd: Rename subcmd header include guards (2015-12-17 14:27:14 -0300)
> >
> > are available in the git repository at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-3
> >
> > for you to fetch changes up to 89af4e05c21d68f22e07fe66940ea675615a49ed:
> >
> > perf stat report: Allow to override aggr_mode (2015-12-17 16:30:30 -0300)
> >
> > ----------------------------------------------------------------
> > perf/core improvement.
> >
> > User visible:
> >
> > - Generate perf.data files from 'perf stat', to tap into the scripting
> > capabilities perf has instead of defining a 'perf stat' specific scripting
> > support to calculate event ratios, etc. Simple example:
> >
> > $ perf stat record -e cycles usleep 1
> >
> > Performance counter stats for 'usleep 1':
> >
> > 1,134,996 cycles
> >
> > 0.000670644 seconds time elapsed
> >
> > $ perf stat report
> >
> > Performance counter stats for '/home/acme/bin/perf stat record -e cycles usleep 1':
> >
> > 1,134,996 cycles
> >
> > 0.000670644 seconds time elapsed
> >
> > $
> >
> > It generates PERF_RECORD_ userspace records to store the details:
> >
> > $ perf report -D | grep PERF_RECORD
> > 0xf0 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 27637
> > 0x118 [0x12]: PERF_RECORD_CPU_MAP nr: 1 cpu: 65535
> > 0x12a [0x40]: PERF_RECORD_STAT_CONFIG
> > 0x16a [0x30]: PERF_RECORD_STAT
> > -1 -1 0x19a [0x40]: PERF_RECORD_MMAP -1/0: [0xffffffff81000000(0x1f000000) @ 0xffffffff81000000]: x [kernel.kallsyms]_text
> > 0x1da [0x18]: PERF_RECORD_STAT_ROUND
> > [acme@ssdandy linux]$
> >
> > An effort was made to make perf.data files generated like this to not
> > generate cryptic messages when processed by older tools.
> >
> > The 'perf script' bits need rebasing, will go up later.
>
> Nice feature!

I tried it out, and it works as expected, cool stuff!

Btw., a very small usability observation: maybe 'perf report' should be enhanced
to recognize 'stat record' generated perf.data files, and display a matching
message?

Right now if I do 'perf report' on such a perf.data then I'll get a "no samples"
TUI message, which is technically correct but somewhat misleading.

It's no big deal - and maybe you guys can think of a better solution than
displaying an error message: maybe 'perf report' should automatically switch to
'perf stat report'?

It would be a bit shorter to type as well and would continue to strengthen the
very nice level of integration that the various subcommands already have today.

But maybe it would be confusing - don't know.

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/