[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [OSSTEST PATCH 33/82] plan search: Move $share_compat_ok further up the file
From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> We are going to want to use this outside the loop. No functional change. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- Osstest/Executive.pm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index e17b6503..4083ae6b 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -684,6 +684,23 @@ sub plan_search ($$$$) { $events ||= [ ]; + my $share_compat_ok = sub { + my ($eshare) = @_; + $dbgprint->("PLAN LOOP SHARE-COMPAT-OK ". + "type $eshare->{Type} vs. ". + ($req->{Shared} // '<undef>')." ". + "wear $eshare->{Wear} ". + "shares $eshare->{Shares} vs. ". + ($req->{SharedMaxTasks}//'<undef>')); + return 0 unless defined $req->{Shared}; + return 0 unless $req->{Shared} eq $eshare->{Type}; + my $wear= $eshare->{Wear}+1; + return 0 if $wear > $req->{SharedMaxWear}; + return 0 if $eshare->{Shares} != $req->{SharedMaxTasks}; + $dbgprint->("PLAN LOOP SHARE-COMPAT-OK Y"); + return 1; + }; + # can we do $req at $try_time ? If not, when later can we ? PERIOD: foreach (my $ix=0; $ix<@$events; $ix++) { @@ -698,23 +715,6 @@ sub plan_search ($$$$) { # this period is entirely after the proposed slot; # so no need to check this or any later periods - my $share_compat_ok = sub { - my ($eshare) = @_; - $dbgprint->("PLAN LOOP SHARE-COMPAT-OK ". - "type $eshare->{Type} vs. ". - ($req->{Shared} // '<undef>')." ". - "wear $eshare->{Wear} ". - "shares $eshare->{Shares} vs. ". - ($req->{SharedMaxTasks}//'<undef>')); - return 0 unless defined $req->{Shared}; - return 0 unless $req->{Shared} eq $eshare->{Type}; - my $wear= $eshare->{Wear}+1; - return 0 if $wear > $req->{SharedMaxWear}; - return 0 if $eshare->{Shares} != $req->{SharedMaxTasks}; - $dbgprint->("PLAN LOOP SHARE-COMPAT-OK Y"); - return 1; - }; - next PERIOD if $endevt->{Time} <= $try_time; # this period is entirely before the proposed slot; # it doesn't overlap, but must check subsequent periods -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |