DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Question regarding rte_rdtsc_precise()
@ 2014-03-24 21:03 Jun Han
  0 siblings, 0 replies; only message in thread
From: Jun Han @ 2014-03-24 21:03 UTC (permalink / raw)
  To: dev

I have a question regarding rte_rdtsc_precise() function. I was not getting
an expected number from the normal rte_rdtsc(), and hence changed to
rte_rdtsc_precise() function and am getting a different value, which seems
to be producing a number close to my expectation.

Q1. However, I wanted to ask if how I am using the function is correct. I
am attaching a code snippet below. Is this the correct way to use
rte_rdtsc_precise() or if I need other things (e.g., adding lfence before
and after for instance?)

begin = rte_rdtsc_precise();
.... do something...
total_time = rte_rdtsc_precise() - begin;
printf("%g cyc\n",(double)total_time);

Q2. Am I correct that the rte_rdtsc_precise() makes the rdtsc a serializing
instruction?
Q3. I found from some sources online that there needs to be about ~ 1000
cycles between consecutive rdtsc() calls to get a more accurate measurement
[1]. Is this true? If so, is this necessary for your rte_rdtsc_precise()?


[1] http://software.intel.com/en-us/forums/topic/305287
"For best results, make sure you have at least ~1,000 clocks worth of
instructions between consecutive rdtsc calls."

Thank  you.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-24 21:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-24 21:03 [dpdk-dev] Question regarding rte_rdtsc_precise() Jun Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).