From 9381ffbc90fe2543f971b2ad102d52e4198e0a11 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Tue, 31 Oct 2017 22:29:01 +0100 Subject: [PATCH] Add Worker.total, total # jobs completed by worker - $!completed is the number of jobs completed since last supervisor check - which is useless for telemetry purposes --- src/core/ThreadPoolScheduler.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/ThreadPoolScheduler.pm b/src/core/ThreadPoolScheduler.pm index 950b44392bf..76341d492c4 100644 --- a/src/core/ThreadPoolScheduler.pm +++ b/src/core/ThreadPoolScheduler.pm @@ -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; @@ -219,6 +222,7 @@ my class ThreadPoolScheduler does Scheduler { $!times-nothing-completed++; } else { + $!total = $!total + $taken; $!times-nothing-completed = 0; } $taken