rte_rdtsc() - what is the performance impact of using rte_rdtsc() time

Stephen Hemminger stephen at networkplumber.org
Tue Oct 3 19:17:58 CEST 2023


On Tue, 3 Oct 2023 15:49:00 +0530
Hari Haran <info2hariharan at gmail.com> wrote:

> >
> > The problem is that rte_rdtsc() stops speculative execution so doing
> > lots of TSC instructions can hurt performance.
> >
> > To correlate TSC timestamp to system time, you need to compute the offsets
> > once at startup. Alternatively, don't use rte_rdtsc() and instead use
> > clock_gettime() with the monotonic timer and the C library does the
> > calculation
> > for you.
> >  
> 
> 
> As part of query 1 and based on your response, I am asking below query
> 
> But usage of clock_gettime() (kernel function) in lcore is advisable one?
> My understanding is,
> shall avoid usage of kernel function in lcore. Correct me if I am wrong?

clock_gettime() is a virtual system call (VDSO) on most Linux platforms.
But it is still slower than simple rte_rdtsc().

Internally clock_gettime VDSO 


More information about the users mailing list