Skip to content

Commit

Permalink
Add Worker.total, total # jobs completed by worker
Browse files Browse the repository at this point in the history
- $!completed is the number of jobs completed since last supervisor check
- which is useless for telemetry purposes
  • Loading branch information
lizmat committed Oct 31, 2017
1 parent dcf3e28 commit 9381ffb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/ThreadPoolScheduler.pm
Expand Up @@ -199,13 +199,16 @@ my class ThreadPoolScheduler does Scheduler {
has int $.completed;
#?endif

# Total number of tasks completed since creation.
has int $.total;

# Working is 1 if the worker is currently busy, 0 if not.
has int $.working;

# Number of times take-completed has returned zero in a row.
has int $.times-nothing-completed;

# Resets the completed to zero.
# Resets the completed to zero and updates the total.
method take-completed() {
#?if moar
my atomicint $taken;
Expand All @@ -219,6 +222,7 @@ my class ThreadPoolScheduler does Scheduler {
$!times-nothing-completed++;
}
else {
$!total = $!total + $taken;
$!times-nothing-completed = 0;
}
$taken
Expand Down

0 comments on commit 9381ffb

Please sign in to comment.