diff Core/JobsEngine/JobsRegistry.cpp @ 3179:fca730c267d7

New primitives to set and refresh metrics
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Jan 2019 17:12:15 +0100
parents 053e72ff9fc5
children 20826867141f
line wrap: on
line diff
--- a/Core/JobsEngine/JobsRegistry.cpp	Wed Jan 30 12:41:20 2019 +0100
+++ b/Core/JobsEngine/JobsRegistry.cpp	Wed Jan 30 17:12:15 2019 +0100
@@ -1402,14 +1402,16 @@
 
   void JobsRegistry::GetStatistics(unsigned int& pending,
                                    unsigned int& running,
-                                   unsigned int& completed)
+                                   unsigned int& success,
+                                   unsigned int& failed)
   {
     boost::mutex::scoped_lock lock(mutex_);
     CheckInvariants();
 
     pending = 0;
     running = 0;
-    completed = 0;
+    success = 0;
+    failed = 0;
     
     for (JobsIndex::const_iterator it = jobsIndex_.begin();
          it != jobsIndex_.end(); ++it)
@@ -1419,18 +1421,21 @@
       switch (job.GetState())
       {
         case JobState_Retry:
-        case JobState_Paused:
         case JobState_Pending:
           pending ++;
           break;
 
+        case JobState_Paused:
         case JobState_Running:
           running ++;
           break;
           
         case JobState_Success:
+          success ++;
+          break;
+
         case JobState_Failure:
-          completed ++;
+          failed ++;
           break;
 
         default: