DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jun Han <junhanece@gmail.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] Question regarding rte_rdtsc_precise()
Date: Mon, 24 Mar 2014 22:03:55 +0100	[thread overview]
Message-ID: <CAGeT4P+mFmvRbWQr+f_ZN_y5wmXAqDMsOJTqiPeHir_+GoDKRg@mail.gmail.com> (raw)

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.

                 reply	other threads:[~2014-03-24 21:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGeT4P+mFmvRbWQr+f_ZN_y5wmXAqDMsOJTqiPeHir_+GoDKRg@mail.gmail.com \
    --to=junhanece@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).