[ltt-dev] UST clock rdtsc vs clock_gettime

Nils Carlson nils.carlson at ludd.ltu.se
Tue Jul 6 15:39:50 EDT 2010


Cool, so the measurements came through...

What I would like to see is the automatic detection of whether the  
rdtsc instruction is usable,
a test for this already exists in the kernel and the question is  
whether this info is currently exported
or whether we need to submit a patch to export it.

Then we should probably start looking at a simple choosing mechanism,  
probably a function pointer?

/Nils
On Jul 6, 2010, at 8:12 PM, David Goulet wrote:

> Hey,
>
> After some talks with Nils from Ericsson, there was some questions  
> about using the TSC counter and not clock_gettime in include/ust/ 
> clock.h
>
> I ran some test after the meeting and was quite surprised by the  
> overhead of clock_gettime.
>
> On an average run ...
> WITH clock_gettime : ~ 266ns per events
> WITH rdtsc instruction : ~ 235ns per events
>
> And it is systematic... I'm getting stable result with rdtsc with  
> standard deviation of ~2ns.
>
> As little as I know on TSC, one thing for sure, with SMP, it becomes  
> much more "fragile" to rely on it because we don't have assurance of  
> coherent counters between CPUs and also the CPU scaling policy  
> (ondemand is default on Ubuntu now). New CPUs support constant_tsc  
> and nonstop_tsc flags but still a small range of them.
>
> Right now, UST is forcing the use of clock_gettime even if i386 or  
> x86_64 is used.
> Should a change be consider ?
>
> Thanks
> David
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev





More information about the lttng-dev mailing list