Reputation: 17482
I need to be able to get the CPU time for the current process from inside some C code.
On Linux, I can use clock_gettime
with CLOCK_PROCESS_CPUTIME_ID
. On BSD I can use clock_gettime
with CLOCK_VIRTUAL
. On Windows, GetProcessTimes. What is the OS X alternative?
Upvotes: 1
Views: 737
Reputation: 24328
You have a couple of options:
There's also a Mach API task_info() but it doesn't seem to offer any obvious benefit over the portable alternatives for querying CPU time.
Upvotes: 2