From: Dmitry Antipov <dmitry.antipov@linaro.org>
To: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
John Stultz <john.stultz@linaro.org>,
linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org
Subject: Re: clock_getres() and real resolution
Date: Thu, 09 Feb 2012 01:25:33 -0800 [thread overview]
Message-ID: <4F33910D.2030409@linaro.org> (raw)
In-Reply-To: <20120209051218.GC2211@netboy.at.omicron.at>
On 02/08/2012 09:12 PM, Richard Cochran wrote:
> I think "resolution" does not mean tick duration, but rather the finest timer unit.
#include <stdio.h>
#include <time.h>
int main (int argc, char *argv[])
{
int i;
struct timespec rs, ts[10];
clock_getres (CLOCK_REALTIME, &rs);
printf ("res: %lus %luns\n", rs.tv_sec, rs.tv_nsec);
for (i = 0; i < 10; i++)
clock_gettime (CLOCK_REALTIME, ts + i);
for (i = 0; i < 10; i++)
printf ("%d: %lus %luns\n", i, ts[i].tv_sec, ts[i].tv_nsec);
return 0;
}
=>
res: 0s 10000000ns
0: 1328779203s 975317500ns
1: 1328779203s 975317900ns
2: 1328779203s 975318200ns
3: 1328779203s 975318400ns
4: 1328779203s 975318600ns
5: 1328779203s 975318800ns
6: 1328779203s 975319000ns
7: 1328779203s 975319300ns
8: 1328779203s 975319500ns
9: 1328779203s 975319600ns
Old Sun Fire 880, SunOS 5.10 Generic_139555-08.
100ns precision with 10ms "finest timer unit"???
Dmitry
next prev parent reply other threads:[~2012-02-09 9:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 16:31 clock_getres() and real resolution Dmitry Antipov
2012-02-09 5:12 ` Richard Cochran
2012-02-09 9:25 ` Dmitry Antipov [this message]
2012-02-09 18:40 ` Richard Cochran
2012-02-09 19:32 ` Dmitry Antipov
2012-02-11 7:39 ` Richard Cochran
2012-02-09 10:12 ` Thomas Gleixner
2012-02-09 15:26 ` Dmitry Antipov
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=4F33910D.2030409@linaro.org \
--to=dmitry.antipov@linaro.org \
--cc=john.stultz@linaro.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=tglx@linutronix.de \
/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).