I’ve pushed a patch that includes the time of “child threads” into statistics. This has been suggested before by @j4n_bur53 . That may result in e.g. (node the
> 100% CPU):
?- time(conc(4, rtest_chats(100))). % 29,686,046 inferences, 2.756 CPU in 0.693 seconds (397% CPU, 10771856 Lips)
As threads do not have a hierarchical relationship, i.e., a thread may live longer than its creator, run “detached” or may be joined by another thread that created it, this is not so easy to define. As is, we add the CPU time and inferences of a child thread to our own time if
- We have created the child thread.
- We join the child (which is when the stats are added).
As a result,
statistics(cputime, X) includes the (finished) child times and there is
statistics(self_cputime, X) to get the time of a thread without children.
Please comment if you see anything wrong with this.