Re: Measure cpu time

2021-05-07 Thread Ali Çehreli via Digitalmars-d-learn
On 5/7/21 9:46 AM, Alain De Vos wrote: I see, https://dlang.org/phobos/core_stdc_time.html does not contain the function : "clock_gettime" Weird ... stdc is about D bindings for C's std headers. I don't think clock_gettime is a standard C function. grep'ping under /usr/include/dmd reveals tha

Re: Measure cpu time

2021-05-07 Thread Alain De Vos via Digitalmars-d-learn
I see, https://dlang.org/phobos/core_stdc_time.html does not contain the function : "clock_gettime" Weird ...

Re: Measure cpu time

2021-05-07 Thread Alain De Vos via Digitalmars-d-learn
Probably renamed ...

Re: Measure cpu time

2021-05-07 Thread Ali Çehreli via Digitalmars-d-learn
On 5/7/21 1:25 AM, Andre Pany wrote: > get the cpu time For the sake of completeness, that kind of functionality is provided by operating systems as well. For example, on Linux, it is common to run the program through 'time' to get how much wall clock advanced, how much time was spent actuall

Re: Measure cpu time

2021-05-07 Thread Andre Pany via Digitalmars-d-learn
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;

Re: Measure cpu time

2021-05-07 Thread Dennis via Digitalmars-d-learn
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

Re: Measure cpu time

2021-05-07 Thread Dennis via Digitalmars-d-learn
On Friday, 7 May 2021 at 08:25:43 UTC, Andre Pany wrote: Is there some equivalent function in Phobos to get the cpu time on linux? I don't think so, but you can use `core.sys.posix.sys.resource: rusage`. If you want to use it on Windows as well, this is a code snippet I wrote for that: ```

Re: Measure cpu time

2021-05-07 Thread Andre Pany via Digitalmars-d-learn
On Friday, 7 May 2021 at 08:37:47 UTC, Imperatorn wrote: On Friday, 7 May 2021 at 08:25:43 UTC, Andre Pany wrote: Hi, I try to convert some python code to D. On python I can get the cpu time for the current process using ``` python dcpu: float = time.process_time() ``` Is there some equival

Re: Measure cpu time

2021-05-07 Thread Imperatorn via Digitalmars-d-learn
On Friday, 7 May 2021 at 08:25:43 UTC, Andre Pany wrote: Hi, I try to convert some python code to D. On python I can get the cpu time for the current process using ``` python dcpu: float = time.process_time() ``` Is there some equivalent function in Phobos to get the cpu time on linux? Ki

Measure cpu time

2021-05-07 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to convert some python code to D. On python I can get the cpu time for the current process using ``` python dcpu: float = time.process_time() ``` Is there some equivalent function in Phobos to get the cpu time on linux? Kind regards André