Clarify meaning of the RTS `taskCount` variable
authorThomas Miedema <thomasmiedema@gmail.com>
Sun, 22 Mar 2015 11:04:18 +0000 (12:04 +0100)
committerThomas Miedema <thomasmiedema@gmail.com>
Sun, 22 Mar 2015 11:11:54 +0000 (12:11 +0100)
In #9261, there was some confusion about the meaning of the taskCount
stats variable in the rts.

It turns out that taskCount is not decremented when a worker task is
stopped (i.e. from workerTaskStop), but only when freeMyTask is called,
which frees the task bound to the current thread. So taskCount is the
current number of bound tasks + the total number of worker tasks.

This makes the calculation of the current number of bound tasks in
rts/Stats.c correct _as is_.

[skip ci]

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D746

rts/Task.c

index 42893fe..be72c1b 100644 (file)
@@ -27,7 +27,7 @@
 // Locks required: all_tasks_mutex.
 Task *all_tasks = NULL;
 
-nat taskCount;
+nat taskCount; // current number of bound tasks + total number of worker tasks.
 nat workerCount;
 nat currentWorkerCount;
 nat peakWorkerCount;