in eventdata/schedulers/utilization_scheduler.py [0:0]
def __init__(self, params, perf_counter=time.perf_counter):
self.logger = logging.getLogger(__name__)
self.perf_counter = perf_counter
self.recording = params.get("record-response-times", False)
if self.recording:
self.logger.info("Running in recording mode.")
self.last_request_start = None
else:
self.logger.info("Running in measurement mode.")
self.target_utilization = float(params["target-utilization"])
if self.target_utilization <= 0.0 or self.target_utilization > 1.0:
raise ValueError("target-utilization must be in the range (0.0, 1.0] but is {}".format(
self.target_utilization))
response_times = UtilizationBasedScheduler.RESPONSE_TIMES
if len(response_times) == 0:
raise ValueError("No response times recorded. Please run first with 'record-response-times'.")
median_response_time_at_full_utilization = statistics.median(response_times)
self.time_between_requests = median_response_time_at_full_utilization * (1 / self.target_utilization)
self.logger.info("Time between requests is [%.3f] seconds for a utilization of [%.2f]%% (based on "
"[%d] samples with a median response time of [%.3f] seconds).",
self.time_between_requests, (self.target_utilization * 100), len(response_times),
median_response_time_at_full_utilization)