From: erik quanstrom <quanstro@quanstro.net>
To: steve@quintile.net, 9fans@9fans.net
Subject: Re: [9fans] high precision timings
Date: Sun, 4 Sep 2011 14:34:56 -0400 [thread overview]
Message-ID: <984d0269db1dd72f1ba77c875b1961f6@ladd.quanstro.net> (raw)
In-Reply-To: <ff871fe92aa6fd40e78b8e7609f78fd6@quintile.net>
On Sun Sep 4 13:48:31 EDT 2011, steve@quintile.net wrote:
> after the recent discussions on nsec()...
>
> does anyone already have the snippet of code to do fine grained
> timeings on the x86 platform using the hardware performance counters?
>
> I would use nsec() but I'am timing systemcalls so I expect my results
> would be swamped by nsec()'s performance.
i wrote up a little demo using a varient of nsec and
using the x86 cycle counter, RDTSC.
the source is in /n/sources/contrib/quanstro/highprec.
i'd recommend doing timings on your particular hardware.
here are my results:
; aux/cpuid -i
AMD Phenom(tm) II X4 965 Processor
; 8.out
nsec latency 25729ns
nsec latency 24554ns
cycle hz = 3393000000
cycles latency 88 cycles; 25 ns
cycles latency 78 cycles; 22 ns
ladd; aux/cpuid -i
Intel(R) Atom(TM) CPU 330 @ 1.60GHz
ladd; 8.out
nsec latency 39501ns
nsec latency 38901ns
cycle hz = 1604000000
cycles latency 60 cycles; 37 ns
cycles latency 48 cycles; 29 ns
new; aux/cpuid -i
Intel(R) Xeon(R) CPU E31220 @ 3.10GHz
new; 8.out
nsec latency 8591ns
nsec latency 9155ns
cycle hz = 3105000000
cycles latency 28 cycles; 9 ns
cycles latency 28 cycles; 9 ns
chula; aux/cpuid -i
Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
chula; 8.out
nsec latency 14319ns
nsec latency 14451ns
cycle hz = 2660000000
cycles latency 40 cycles; 15 ns
cycles latency 32 cycles; 12 ns
it seems like you can get ±10ns at a few 10s of
ns latency with _cycles and ±10µs at a few 10s
of µs latency with /dev/bintime.
- erik
next prev parent reply other threads:[~2011-09-04 18:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-04 17:47 Steve Simon
2011-09-04 18:34 ` erik quanstrom [this message]
2011-09-05 4:42 ` ron minnich
2011-09-05 4:50 ` s s
2011-09-05 4:53 ` s s
2011-09-05 6:27 ` dexen deVries
[not found] ` <CAP6exYLkin_LGZCDCGYcSLqTNHZOfPWc6f=S0LLDG0q_WEhdZA@mail.gmail.c>
2011-09-05 4:48 ` erik quanstrom
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=984d0269db1dd72f1ba77c875b1961f6@ladd.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
--cc=steve@quintile.net \
/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).