Measuring ticks (or time) per threads
Rob T
alanb at ucora.com
Wed Dec 4 14:55:45 PST 2013
On Wednesday, 4 December 2013 at 20:12:41 UTC, Phil wrote:
> Hi guys,
>
> I'd like to know if there is a way using the stdlib that I can
> measure the number of ticks that a thread has been working. I
> do mean the number of ticks that it has been ACTIVE, and not
> the noTicks since its creation.
>
> Thanks!
> Phil
The D core.thread lib could certainly have more functions added
to it.
If you are using a posix compatible OS, check out
core.sys.posix.sys.resource;
Use this function to get runtime stats
int getrusage(int, rusage*);
For usage details, consult the manpage
http://linux.die.net/man/2/getrusage
The times returned are in seconds+msec but you can convert to
approx ticks using conversion functions in core.clock.
As for Windows, I have no idea how to get this information, but
there's probably a way.
--rt
More information about the Digitalmars-d-learn
mailing list