Process_cputime, thread_cputime

I put some measurements (using statistics/2) around a predicate that’s called by an http_handler, and to my surprise, thread_cputime showed 0. Both process_cputime and cputime showed reasonable values.

Do I need to do something to activate thread cputime measurements?

From the docs: _“Seconds CPU time used by finished threads.”. Bold by me; should probably also be bold in the docs too.

cputime gives the CPU time of the calling thread (only). process_cputime of the entire process and using thread_statistics/3 you can query the stats of other (running) threads.

I saw that but thought it was a typo. I also missed the plural “threads”.

So, for a thread’s cputime, I should use statistics(cputime, ...) and for total cputime for all threads, I should use statistics(process_cputime, ...)?

That is correct