[dpdk-dev] rte_get_tsc_cycles function slowly increase ?

小祥子 wang010366 at vip.qq.com
Fri Jul 2 11:36:18 CEST 2021


hi all,


rte_get_tsc_cycles function slowly increase, gettimeofday function is normally increase.

The following pseudo-code is my test example:
``` uint64_t hz = rte_get_tsc_hz(); uint64_t start_cycles = rte_get_tsc_cycles();           // running on first cpuuint64_t start_time = gettimeofday();                   // running on first cpu <perform operations>                                    // running for 1 day or 2 day uint64_t end_cycles = rte_get_tsc_cycles();             // running on second cpuuint64_t end_time = gettimeofday();                     // running on first cpu
elapsed1_s = (end_cycles - start_cycles) / hz;elapsed2_s = (end_time - start_time);
``` 



I found a  phenomenon that elapsed1_s is inaccurate, elapsed2_s is accurate. and the gap between elapsed2_s and elapsed1_s has increasingly widened.  


why? how to explain the phenomenon or fix the problem.




Hope that helps! Regards, 
wang.


More information about the dev mailing list