Thread overview
Measuring ticks (or time) per threads
Dec 04, 2013
Phil
Dec 04, 2013
Rob T
Dec 05, 2013
Phil
Dec 05, 2013
Rob T
Dec 05, 2013
Rob T
Dec 06, 2013
Phil Lavoie
December 04, 2013
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
December 04, 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
December 05, 2013
On Wednesday, 4 December 2013 at 22:55:46 UTC, Rob T wrote:
> 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

That function sounds great. Unfortunately I am working on Windows so I guess I'll have to look into their API. I was hoping for a solution available in the std but if there isn't than there isn't. Thanks for you information!
December 05, 2013
On Thursday, 5 December 2013 at 00:53:00 UTC, Phil wrote:
>
> That function sounds great. Unfortunately I am working on Windows so I guess I'll have to look into their API. I was hoping for a solution available in the std but if there isn't than there isn't. Thanks for you information!

You may find something in core.sys.windows.windows.d. My understanding is that it's not a full interface into the windows API, but enough may be there.

--rt

December 05, 2013
Also please post a bug or enhancement issue for anything that you think ought to be included in the standard libs that isn't.

https://d.puremagic.com/issues/

--rt
December 06, 2013
On Thursday, 5 December 2013 at 06:22:35 UTC, Rob T wrote:
> Also please post a bug or enhancement issue for anything that you think ought to be included in the standard libs that isn't.
>
> https://d.puremagic.com/issues/
>
> --rt

Done