Module: tools
Branch: master
Commit: c40e81b67b22353b285edbebdbe3c00f3d3da6f3
URL: https://source.winehq.org/git/tools.git/?a=commit;h=c40e81b67b22353b285edbe…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Fri Feb 9 03:23:47 2018 +0100
testbot: Fix activity statistics for short periods of time.
When looking at the activity for a VM we get an initial 'unknown'
segment that goes up to the first record for that VM. This is because
we don't know what the state of the VM was before that first record.
For long periods it does not matter much but for short ones, say 5
minutes, an unknown segment could be all we have if the VM has been in
the same state for more than 5 minutes, for instance while running a
task.
So analyze the activity beyond the specified period, up to the largest
amount of time a task can take so we are sure to get the VM's 'previous'
record. Then, when computing the statistics, ignore any data that falls
outside the period under consideration.
Of course this only works for statistics about VM operations and
running tasks (so running.time, reverting.time, etc) not for those
about idle or off VMs (idle.time, etc.).
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/Activity.pm | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/Activity.pm b/testbot/lib/WineTestBot/Activity.pm
index df1cc59..4aed4ed 100644
--- a/testbot/lib/WineTestBot/Activity.pm
+++ b/testbot/lib/WineTestBot/Activity.pm
@@ -412,11 +412,33 @@ sub GetStatistics($;$)
@JobTimes = (); # free early
}
- my ($Activity, $Counters) = GetActivity($VMs, $Seconds);
+ my $ActivitySeconds;
+ if ($Seconds)
+ {
+ # When looking at the activity for a VM we get an initial 'unknown' segment
+ # that goes up to the first record for that VM. This is because we don't
+ # know what the state of the VM was before that first record.
+ # For long periods it does not matter much but for short ones, say 5
+ # minutes, an unknown segment could be all we have if the VM has been in
+ # the same state for more than 5 minutes, for instance while running a
+ # task.
+ # So analyze the activity beyond the specified period, up to the largest
+ # amount of time a task can take so are sure to get the VM's 'previous'
+ # record. Then when computing the statistics, ignore any data that falls
+ # outside the period under consideration.
+ # Of course this only works for statistics about VM operations and running
+ # tasks (so running.time, reverting.time, etc) not for those about idle or
+ # off VMs (idle.time, etc.).
+ $ActivitySeconds = $Seconds + 60 +
+ ($SuiteTimeout > $ReconfigTimeout ? $SuiteTimeout : $ReconfigTimeout);
+ }
+ my ($Activity, $Counters) = GetActivity($VMs, $ActivitySeconds);
$GlobalStats->{"recordgroups.count"} = $Counters->{recordgroups};
$GlobalStats->{"records.count"} = $Counters->{records};
foreach my $Group (@$Activity)
{
+ next if ($Group->{end} < $Cutoff);
+
_UpdateMin($VMsStats->{start}, $Group->{start});
next if (!$Group->{statusvms});
Module: tools
Branch: master
Commit: f421e67ed2239b5f519db69dbcf903fa6428ad7e
URL: https://source.winehq.org/git/tools.git/?a=commit;h=f421e67ed2239b5f519db69…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Fri Feb 9 03:22:44 2018 +0100
testbot: Allow restricting the statistics to the recent past.
Over long periods of time (days) and as long as the TestBot can keep
up, the job & task creation rate should be almost identical to the
job and task completion rate (modulo build errors for tasks). But for
short periods (under an hour) they can be significantly different.
Specifically the job and task completion rates are capped by the
TestBot's processing speed, while the job and task creation rates are
not.
This means jobs must be filtered based on their Submitted field when
counting new jobs, and on their Ended field when dealing with completed
jobs.
Rename the job and task counters to newjobs and newtasks to emphasize
that they count new jobs and tasks.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/Activity.pm | 32 +++++++++++++++++++++-----------
testbot/web/Stats.pl | 12 ++++++------
2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/testbot/lib/WineTestBot/Activity.pm b/testbot/lib/WineTestBot/Activity.pm
index 5122dc3..df1cc59 100644
--- a/testbot/lib/WineTestBot/Activity.pm
+++ b/testbot/lib/WineTestBot/Activity.pm
@@ -43,6 +43,12 @@ sub _UpdateMin($$)
$_[0] = $_[1] if (!defined $_[0] or $_[1] < $_[0]);
}
+sub max($$)
+{
+ my ($a, $b) = @_;
+ return $a > $b ? $a : $b;
+}
+
=pod
=over 12
@@ -336,18 +342,20 @@ sub _AddFullStat($$$$;$)
}
}
-sub GetStatistics($)
+sub GetStatistics($;$)
{
- my ($VMs) = @_;
+ my ($VMs, $Seconds) = @_;
my ($GlobalStats, $HostsStats, $VMsStats) = ({}, {}, {});
my @JobTimes;
my $Jobs = CreateJobs();
+ my $Cutoff = $Seconds ? (time() - $Seconds) : 0;
foreach my $Job (@{$Jobs->GetItems()})
{
- $GlobalStats->{"jobs.count"}++;
- _UpdateMin($GlobalStats->{start}, $Job->Submitted);
+ my $CountsAsNew = ($Job->Submitted >= $Cutoff);
+ $GlobalStats->{"newjobs.count"}++ if ($CountsAsNew);
+ _UpdateMin($GlobalStats->{start}, max($Cutoff, $Job->Submitted));
my $IsSpecialJob;
my $Steps = $Job->Steps;
@@ -359,9 +367,11 @@ sub GetStatistics($)
my $Tasks = $Step->Tasks;
foreach my $Task (@{$Tasks->GetItems()})
{
- $GlobalStats->{"tasks.count"}++;
- if ($Task->Started and $Task->Ended and
- $Task->Status !~ /^(?:queued|running|canceled)$/)
+ $GlobalStats->{"newtasks.count"}++ if ($CountsAsNew);
+ next if (!$Task->Ended or $Task->Ended < $Cutoff);
+
+ # $Task->Started should really be set since $Task->Ended is
+ if ($Task->Started and $Task->Status !~ /^(?:queued|running|canceled)$/)
{
my $Time = $Task->Ended - $Task->Started;
_AddFullStat($GlobalStats, "$StepType.time", $Time, undef, $Task);
@@ -383,7 +393,7 @@ sub GetStatistics($)
}
}
- if (!$IsSpecialJob and$Job->Ended and
+ if (!$IsSpecialJob and $Job->Ended and $Job->Ended >= $Cutoff and
$Job->Status !~ /^(?:queued|running|canceled)$/)
{
my $Time = $Job->Ended - $Job->Submitted;
@@ -402,7 +412,7 @@ sub GetStatistics($)
@JobTimes = (); # free early
}
- my ($Activity, $Counters) = GetActivity($VMs);
+ my ($Activity, $Counters) = GetActivity($VMs, $Seconds);
$GlobalStats->{"recordgroups.count"} = $Counters->{recordgroups};
$GlobalStats->{"records.count"} = $Counters->{records};
foreach my $Group (@$Activity)
@@ -456,14 +466,14 @@ sub GetStatistics($)
# Note that we cannot simply sum the VMs busy wall clock times to get
# the host busy wall clock time because this would count periods where
# more than one VM is busy multiple times.
- $HostStats->{"busy.elapsed"} += $Group->{end} - $Group->{start};
+ $HostStats->{"busy.elapsed"} += $Group->{end} - max($Cutoff, $Group->{start});
$IsHostBusy{$Host} = 1;
$IsGroupBusy = 1;
}
}
if ($IsGroupBusy)
{
- $GlobalStats->{"busy.elapsed"} += $Group->{end} - $Group->{start};
+ $GlobalStats->{"busy.elapsed"} += $Group->{end} - max($Cutoff, $Group->{start});
}
}
diff --git a/testbot/web/Stats.pl b/testbot/web/Stats.pl
index 9db2ad3..51a7227 100644
--- a/testbot/web/Stats.pl
+++ b/testbot/web/Stats.pl
@@ -206,12 +206,12 @@ sub GenerateBody($)
_GenGlobalLine($GlobalStats, "elapsed", "Job history", "How far back the job history goes.");
- _GenGlobalLine($GlobalStats, "jobs.count", "Job count", "The number of jobs in the job history.");
- _AddRate($GlobalStats, "jobs.count");
- _GenGlobalLine($GlobalStats, "jobs.rate", "Job rate", "How fast new jobs are coming in.");
- _GenGlobalLine($GlobalStats, "tasks.count", "Task count", "The number of tasks.");
- _AddRate($GlobalStats, "tasks.count");
- _GenGlobalLine($GlobalStats, "tasks.rate", "Task rate", "How fast new tasks are coming in.");
+ _GenGlobalLine($GlobalStats, "newjobs.count", "Job count", "The number of jobs in the job history.");
+ _AddRate($GlobalStats, "newjobs.count");
+ _GenGlobalLine($GlobalStats, "newjobs.rate", "Job rate", "How fast new jobs are coming in.");
+ _GenGlobalLine($GlobalStats, "newtasks.count", "Task count", "The number of tasks.");
+ _AddRate($GlobalStats, "newtasks.count");
+ _GenGlobalLine($GlobalStats, "newtasks.rate", "Task rate", "How fast new tasks are coming in.");
_GenGlobalLine($GlobalStats, "busy.elapsed", "Busy time", "How much wall clock time was spent running jobs.", $NO_PERCENTAGE);
_GenGlobalLine($GlobalStats, "busy.elapsed", "Busy \%", "The percentage of wall clock time where the TestBot was busy running jobs.");