Hello,

On Wed, Nov 26, 2008 at 4:33 AM, Nagy Mostafa <[EMAIL PROTECTED]> wrote:
> Hi,
> When running pfmon in sampling mode, is there a way to know when each sample
> was taken (time, or cycle count)? Can I make pfmon print the cycle count for
> each sample.
>
> If this is not the way to go, can you please guide me to an alternative way
> of doing that ?
>
There are several ways of doing that. With the default sampling buffer
format, which
pfmon is using, each sample contains a timestamp field. That timestamp
is guaranteed
constantly increasing IF AND ONLY IF the thread remains on the same
CPU. That timestamp
is based on the TSC of the CPU.

But a better and more portable way it to specify a second event and
print the raw samples. That
method works even if the thread migrates. You would do as follows:

$ pfmon --smpl-module=compact --with-header
-emy_event,unhalted_reference_cycles --long-smpl-periods=140000
my_program

And this will generate an output similar to:

# description of columns:
#       column  1: entry number
#       column  2: process id
#       column  3: thread id
#       column  4: cpu number
#       column  5: instruction pointer
#       column  6: unique timestamp
#       column  7: overflowed PMD index
#       column  8: event set
#       column  9: initial value of overflowed PMD (sampling period)
#       followed by optional sampled PMD values in command line order
#
#
0            5854     5854  3 0x400621 0x0000002aaadf4476  17     0
      -140000 0x3363c
1            5854     5854  3 0x400621 0x0000002aaae0b512  17     0
      -140000 0x66c78
2            5854     5854  3 0x400621 0x0000002aaae21813  17     0
      -140000 0x9a2bd
3            5854     5854  3 0x400621 0x0000002aaae37a5c  17     0
      -140000 0xcd8f9
4            5854     5854  3 0x400621 0x0000002aaae4dc69  17     0
      -140000 0x100f3e
5            5854     5854  3 0x400621 0x0000002aaae63e67  17     0
      -140000 0x134583

The last column shows the value of 'unhalted_reference_cycles' (your
timestamp) for each sample (one sample/line).
Coulmn 6 shows the other timestamp I was referring to, but it is not
guarantee unique across multiple CPUs.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to