1 # Copyright (c) 2021 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 """Module defining ProgressState class."""
18 """Structure containing data to be passed around in recursion.
20 This is basically a private class of MultipleRatioSearch,
21 but keeping it in a separate file makes things more readable.
25 self, database, phases, duration, width_goal, packet_loss_ratios,
26 min_rate, max_rate, stop_time):
27 """Convert and store the argument values.
29 Also initializa the stored width for external search.
31 :param result: Structure containing measured results.
32 :param phases: How many intermediate phases to perform
33 before the current one.
34 :param duration: Trial duration to use in the current phase [s].
35 :param width_goal: The goal relative width for the curreent phase.
36 :param packet_loss_ratios: List of ratios for the current search.
37 :param min_rate: Minimal target transmit rate available
38 for the current search [tps].
39 :param max_rate: Maximal target transmit rate available
40 for the current search [tps].
41 :param stop_time: Monotonic time [s] when we should fail on timeout.
42 :type result: MeasurementDatabase
45 :type width_goal: float
46 :type packet_loss_ratios: Iterable[float]
49 :type stop_time: float
51 self.database = database
52 self.phases = int(phases)
53 self.duration = float(duration)
54 self.width_goal = float(width_goal)
55 self.packet_loss_ratios = [
56 float(ratio) for ratio in packet_loss_ratios
58 self.min_rate = float(min_rate)
59 self.max_rate = float(max_rate)
60 self.stop_time = float(stop_time)