Using rdtsc to timestamp RTT of packets Stephen/Gabor/Harry: Gents thanks for the guidance; this mailing list is great. The message is rdtsc is just fine. Got it. The command line (from Harry): >lscpu | egrep "constant_tsc|nonstop_tsc" is operationally ideal: specific, easy, and answers the issue of invariance/constancy clearly. On Mon, Mar 6, 2023 at 11:56 AM Stephen Hemminger < stephen@networkplumber.org> wrote: > On Sun, 5 Mar 2023 20:01:15 -0500 > fwefew 4t4tg <7532yahoo@gmail.com> wrote: > > > I think rdtsc does all this. But then I read [1]: > > > > - The TSC is not always invariant > > - And of course context switches (if a thread is not pinned to a core) > > will invalidate any time difference > > - The TSC is not incremented when the processor enters a deep sleep. I > > don't care about this because I'll turn off the power saving modes > anyway > > Stack Overflow is only one step better than ChatGPT in giving > partially correct answers. > > TSC is almost always works well on modern processors. > The Linux kernel aligns all the TSC values for each core at boot up. > It is invariant (derived from a single clock source) unless you have some > poorly designed NUMA system. In the past, there were some CPU's that > did bad things during suspend, but that is fixed in current generations. > > Bottom line: that advice is no longer true. >