Francois Gouget : testbot: Fix the activity start and end times.

Alexandre Julliard julliard at winehq.org
Thu Feb 8 14:58:28 CST 2018


Module: tools
Branch: master
Commit: 2939680d831e6fd954a7455faf38c32a9405acec
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=2939680d831e6fd954a7455faf38c32a9405acec

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Feb  8 12:09:44 2018 +0100

testbot: Fix the activity start and end times.

Even if the last job completed hours ago, the period covered by the data
we have in the jobs table always goes all the way up to now. Also it
starts with when the oldest job on record was submitted, whether that
job completed successfully or not.
Similarly the data in our activity records always covers everything up
until the present.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/WineTestBot/Activity.pm | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/testbot/lib/WineTestBot/Activity.pm b/testbot/lib/WineTestBot/Activity.pm
index 8c22e01..5d8ee5f 100644
--- a/testbot/lib/WineTestBot/Activity.pm
+++ b/testbot/lib/WineTestBot/Activity.pm
@@ -43,11 +43,6 @@ sub _UpdateMin($$)
   $_[0] = $_[1] if (!defined $_[0] or $_[1] < $_[0]);
 }
 
-sub _UpdateMax($$)
-{
-  $_[0] = $_[1] if (!defined $_[0] or $_[0] < $_[1]);
-}
-
 
 =pod
 =over 12
@@ -345,6 +340,7 @@ sub GetStatistics($)
   foreach my $Job (@{$Jobs->GetItems()})
   {
     $GlobalStats->{"jobs.count"}++;
+    _UpdateMin($GlobalStats->{start}, $Job->Submitted);
 
     my $IsSpecialJob;
     my $Steps = $Job->Steps;
@@ -386,9 +382,6 @@ sub GetStatistics($)
       my $Time = $Job->Ended - $Job->Submitted;
       _AddFullStat($GlobalStats, "jobs.time", $Time, undef, $Job);
       push @JobTimes, $Time;
-
-      _UpdateMin($GlobalStats->{start}, $Job->Submitted);
-      _UpdateMax($GlobalStats->{end}, $Job->Ended);
     }
   }
 
@@ -408,7 +401,6 @@ sub GetStatistics($)
   foreach my $Group (@$Activity)
   {
     _UpdateMin($VMsStats->{start}, $Group->{start});
-    _UpdateMax($VMsStats->{end}, $Group->{end});
     next if (!$Group->{statusvms});
 
     my ($IsGroupBusy, %IsHostBusy);
@@ -464,6 +456,9 @@ sub GetStatistics($)
       $GlobalStats->{"busy.elapsed"} += $Group->{end} - $Group->{start};
     }
   }
+
+  # The end is now!
+  $GlobalStats->{end} = $VMsStats->{end} = $Counters->{now};
   $GlobalStats->{elapsed} = $GlobalStats->{end} - $GlobalStats->{start};
   $HostsStats->{elapsed} =
       $VMsStats->{elapsed} = $VMsStats->{end} - $VMsStats->{start};




More information about the wine-cvs mailing list