Boost logo

Boost Users :

Subject: Re: [Boost-users] [chrono] using user + system process cpu time
From: Julian Gonggrijp (j.gonggrijp_at_[hidden])
Date: 2011-08-28 17:02:25


Vicente J. Botet Escriba wrote:

> Le 26/08/11 13:01, Julian Gonggrijp a écrit :
>>
>> Could you please advice me on the best way to find both the user and
>> system components of the process cpu time taken by a piece of code?
>
> I see a way a little bit verbose but not too much complicated:
>
> clock::duration delta = end-start;
> process_cpu_clock_times times=delta.count();
> return (process_user_cpu_clock::duration(times.user) + process_system_cpu_clock::duration(times.system));

Thanks! It's a bit verbose indeed but I'm already glad there is a way that doesn't involve two clocks.

-Julian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net