Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/Activity.pm | 2 +- testbot/lib/WineTestBot/RecordGroups.pm | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/testbot/lib/WineTestBot/Activity.pm b/testbot/lib/WineTestBot/Activity.pm index 2a1e21f0b..b82d265f8 100644 --- a/testbot/lib/WineTestBot/Activity.pm +++ b/testbot/lib/WineTestBot/Activity.pm @@ -111,7 +111,7 @@ sub GetActivity($;$) } my $MinId; $Counters->{recordgroups} = $RecordGroups->GetItemsCount(); - foreach my $RecordGroup (sort CompareRecordGroups @{$RecordGroups->GetItems()}) + foreach my $RecordGroup (@{$RecordGroups->GetSortedItems()}) { my $Group = { id => $RecordGroup->Id, start => $RecordGroup->Timestamp }; diff --git a/testbot/lib/WineTestBot/RecordGroups.pm b/testbot/lib/WineTestBot/RecordGroups.pm index f0945434c..c3022ae5b 100644 --- a/testbot/lib/WineTestBot/RecordGroups.pm +++ b/testbot/lib/WineTestBot/RecordGroups.pm @@ -43,6 +43,16 @@ sub InitializeNew($$) $self->SUPER::InitializeNew($Collection); }
+sub Compare($$) +{ + my ($self, $B) = @_; + + # The Timestamps have a 1 second granularity and may have duplicates. + # So use the Id to break ties. And use GetColValue() for performance. + return $self->GetColValue("Timestamp") <=> $B->GetColValue("Timestamp") || + $self->GetColValue("Id") <=> $B->GetColValue("Id"); +} +
package WineTestBot::RecordGroups;
@@ -57,7 +67,7 @@ use WineTestBot::WineTestBotObjects; BEGIN { our @ISA = qw(WineTestBot::WineTestBotCollection); - our @EXPORT = qw(CreateRecordGroups CompareRecordGroups SaveRecord); + our @EXPORT = qw(CreateRecordGroups SaveRecord); }
use ObjectModel::BasicPropertyDescriptor; @@ -96,16 +106,6 @@ sub CreateRecordGroups(;$) @PropertyDescriptors, $ScopeObject); }
-sub CompareRecordGroups($$) -{ - my ($RecordGroup1, $RecordGroup2) = @_; - - # The Timestamps have a 1 second granularity and may have duplicates. - # So use the Id to break ties. - return $RecordGroup1->Timestamp <=> $RecordGroup2->Timestamp || - $RecordGroup1->Id <=> $RecordGroup2->Id; -} - =pod =over 12