sawsen11 / jrfonseca

Automatically exported from code.google.com/p/jrfonseca
0 stars 0 forks source link

[gprof2dot] [perf] Incorrect event counting #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The perf parser does not use the number of events recorded for each call stack, 
but assumes it to be 1. This number is reported in the header of each call 
stack, as a line of form "<program> <count> <unit>:". Attached is a possible 
fix.

Original issue reported on code.google.com by stefan.b...@gmail.com on 5 Aug 2014 at 11:26

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Sorry for the delay.  I was on vacation when I first got this, and forgot to 
flag it, and forgot it until recently.

> This number is reported in the header of each call stack, as a line of form 
"<program> <count> <unit>:"

Are you sure about this?

According to 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/tools/perf/
builtin-script.c?id=refs/tags/v3.16#n320 , `perf script` reports output is in 
the form:

  <command> <pid> [<cpu>] <timestamp>: <event>:

There seems to be no field to match your "count".

None of the sample files I have seem to anything like a sample count.  That is, 
each call stack seems to correspond to one event, and one event only.

Jose

Original comment by Jose.R.F...@gmail.com on 23 Sep 2014 at 8:36

GoogleCodeExporter commented 9 years ago
Jose, you're totally right. Sorry about this confusion! I was actually 
profiling a multi-threaded program and I saw the "<number> cycles" pattern in 
the "perf script" output, where <number> was varying from one event to the 
other, so I inferred it represented the number of cycles recorded for that 
callstack.

Original comment by stefan.b...@gmail.com on 29 Sep 2014 at 10:11

GoogleCodeExporter commented 9 years ago
Thanks for confirming.

Original comment by Jose.R.F...@gmail.com on 29 Sep 2014 at 10:17