View mode: basic / threaded / horizontal-split · Log in · Help
July 12, 2007
Performance Counter output
I'm trying to see how long a particular part of code takes to run, but the
counter gives me strange outputs.

PerformanceCounter c = new PerformanceCounter();
c.start();

// some code

c.stop();

writefln("Seconds:      %x",c.seconds());
writefln("Milliseconds: %x",c.milliseconds());
writefln("Microseconds: %x",c.microseconds());


gives me for example this:

Seconds:      2
Milliseconds: af2
Microseconds: 2ac3c2

What am I missing?
July 12, 2007
Re: Performance Counter output
ginophi skrev:
> I'm trying to see how long a particular part of code takes to run, but the
> counter gives me strange outputs.
> 
> PerformanceCounter c = new PerformanceCounter();
> c.start();
> 
> // some code
> 
> c.stop();
> 
> writefln("Seconds:      %x",c.seconds());
> writefln("Milliseconds: %x",c.milliseconds());
> writefln("Microseconds: %x",c.microseconds());
> 
> 
> gives me for example this:
> 
> Seconds:      2
> Milliseconds: af2
> Microseconds: 2ac3c2
> 
> What am I missing?

change %x -> %s


-- 
Oskar
July 12, 2007
Re: Performance Counter output
Oh.. That helped me find http://www.digitalmars.com/d/phobos/std_format.html
which explains a lot. Thanks.

"Oskar Linde" <oskar.lindeREM@OVEgmail.com> wrote in message
news:f74ldv$k79$1@digitalmars.com...
> ginophi skrev:
> > I'm trying to see how long a particular part of code takes to run, but
the
> > counter gives me strange outputs.
> >
> > PerformanceCounter c = new PerformanceCounter();
> > c.start();
> >
> > // some code
> >
> > c.stop();
> >
> > writefln("Seconds:      %x",c.seconds());
> > writefln("Milliseconds: %x",c.milliseconds());
> > writefln("Microseconds: %x",c.microseconds());
> >
> >
> > gives me for example this:
> >
> > Seconds:      2
> > Milliseconds: af2
> > Microseconds: 2ac3c2
> >
> > What am I missing?
>
> change %x -> %s
>
>
> -- 
> Oskar
Top | Discussion index | About this forum | D home