dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyal <dmitryvyal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Patrick Mahan <mahan-5dHXHCkEAVbYtjvyW6yDsg@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: Recommended method of getting timestamps?
Date: Fri, 06 Sep 2013 10:33:58 +0400	[thread overview]
Message-ID: <52297756.7060308@gmail.com> (raw)
In-Reply-To: <16BB02EF-879C-4DB1-804E-E5E6E08B935E-5dHXHCkEAVbYtjvyW6yDsg@public.gmane.org>

Hello Patrick,

I guess gettimeofday is too heavy if all you need is an abstract 
timestamp not related to any particular calendar. I think you should 
look at rte_rdtsc()? It returns a current value of CPU tick counter. So 
it's very cheap (just a few clocks) and has a great resolution (a 
fraction of nanosecond).

Regards,
Dmitry

> I have a need to keep a timestamp on a piece of global data.  When then timestamp grows too old I want to refresh that data.  Is it safe to use, gettimeofday()?
>
> I thought about using an alarm, but I need to set an alarm from inside the alarm callback which doesn't look like it will work due to the spinlock on the alarm list.
>
> And since this is inside the driver I am working on, setting up a timer is not simple.
>
> So, I figure to timestamp the data, wait until I need to access it, check the timestamp and refresh if it is too old.
>
> Thoughts?  Suggestions?
>
> Thanks,
>
> Patrick
>
> Coming to you from deep inside Fortress Mahan

  parent reply	other threads:[~2013-09-06  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 18:01 Recommended method of getting timestamps? Patrick Mahan
     [not found] ` <16BB02EF-879C-4DB1-804E-E5E6E08B935E-5dHXHCkEAVbYtjvyW6yDsg@public.gmane.org>
2013-09-05 18:09   ` Daniel Cegiełka
2013-09-06  6:33   ` Dmitry Vyal [this message]
     [not found]     ` <52297756.7060308-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-06  6:45       ` Stephen Hemminger

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=52297756.7060308@gmail.com \
    --to=dmitryvyal-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=mahan-5dHXHCkEAVbYtjvyW6yDsg@public.gmane.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).