Hello, On Wed, Jan 21, 2009 at 2:41 PM, Nagy Mostafa <nagy.most...@gmail.com> wrote: > Hi, > I am trying to correlate timestamped samples by pfmon to timestamped events > collected from the profiled program by instrumentation. The samples and > events are collected from the same run. In other words, I run my > instrumented program using pfmon to collect a pfmon profile and a > timestamped execution trace. For pfmon I simply use the unique timestamp > column value (based on TSC) and I use rdtsc for my program. My problem is > that the timestamps do not match, there is always a shift that is large > enough to make the first pfmon sample out of range of the collected events. > I am using a dual core x86 machine. My questions are: > I am assuming you are talking about the tstamp field in the sample. This one reports a unique timestamp based on the kernel sched_clock() interface. it is different from the TSC. If I recall correctly, it returns the current time in ns. If multiple cores call this function in the same nanosecond, they could get the same value, very unlikely though.
As for your problem, I would not expect the timestamps to match exactly anyway. > - I am assuming this is because of frequency scaling effect. Could it be > something else ? I think on recent Intel (and AMD) processor, the TSC is not affected by frequency scaling. This is a feature indicated by constant_tsc flag in /proc/cpuinfo. But I am not an x86 expert. > - If I turn off freq. scaling, is it guaranteed that TSC value will be > synchronized on both cores ? No. > - I use rdtsc because it is the only way I know that enables me to read time > from user-space without a syscall, so it is cheap. Is there any better ways > of doing that for x86 or other architectures ? > gettimeofday() has some fast implementations using lightweight syscalls if I recall. ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel