[Mono-dev] high-resolution timer in Mono?
jacek.blaszczynski at acn.waw.pl
Sat Feb 25 06:08:51 EST 2006
QueryPerformanceCounter() does not provide that high resolution either (only
on 2 or more processor machines resolution is exactly 1 processor tick +/-
call cycles) otherwise its the very same as for DateTime.UtcNow (but not
DateTime.Now - which takes some extra overhead) for details check blogs on
Please check the link below for project NGmp on sourceforge.net (it's CIL
binding for GMP and MPFR multiprecision numeric libraries) - first files
will be released later today - for some utility code which will help you on
both Unix/Linux and Windows x86 platforms with very pecise time measurments.
Method GetProcessorTicks() in class Utilities implemements P/Invoke wrapper
for call to native rdtsc x86 instruction which allows for reading internal
x86 processor cycle counter thus providing the ultimate timer resolution
which can be thought of. The measurment overhead is roughly 100 processor
cycles on .NET after compiling assembly with ngen (Mono --aot option does
not work with my code due to some bugs which I am going to file to bugzilla
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Brian Crowell
Sent: Friday, February 24, 2006 7:09 PM
Cc: 'mono-devel mailing list'
Subject: Re: [Mono-dev] high-resolution timer in Mono?
Jonathan Resnick wrote:
> What is the best way to do accurate high-resolution timing in Mono on
> Linux? I'm basically looking for the equivalent of
> QueryPerformanceCounter() on Windows... I looked at
> System.Environment.TickCount, but it has a resolution that "cannot be
> less than 500 milliseconds", according to the Mono docs. Is there a
> high-resolution timer available to Mono?
Not that I know of, but anyone wanting to develop one would want to
implement the new System.Diagnostics.Stopwatch class from .NET 2.0. It was
designed to wrap/replace QueryPerformanceCounter(). I guess a lot of people
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list