Measure cpu time

Andre Pany andre at s-e-a-p.de
Fri May 7 09:27:08 UTC 2021


On Friday, 7 May 2021 at 08:58:33 UTC, Dennis wrote:
> On Friday, 7 May 2021 at 08:52:13 UTC, Dennis wrote:
>> If you want to use it on Windows as well, this is a code 
>> snippet I wrote for that:
>
> For completeness, the imports it uses:
> ```D
> version(Windows) {
> 	import core.sys.windows.windows;
> 	import core.sys.windows.psapi: PROCESS_MEMORY_COUNTERS, 
> GetProcessMemoryInfo;
> } else version(Posix) {
> 	import core.sys.posix.sys.resource: rusage, getrusage, 
> RUSAGE_SELF, timeval;
> } else {
> 	static assert(0, "unsupported platform");
> }
> ```

Thanks a lot.

Kind regards
André


More information about the Digitalmars-d-learn mailing list