diff options
Diffstat (limited to 'crosperf/experiment_status.py')
-rw-r--r-- | crosperf/experiment_status.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/crosperf/experiment_status.py b/crosperf/experiment_status.py index c6610433..2ac47c74 100644 --- a/crosperf/experiment_status.py +++ b/crosperf/experiment_status.py @@ -1,8 +1,11 @@ +# -*- coding: utf-8 -*- # Copyright 2011 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + """The class to show the banner.""" +from __future__ import division from __future__ import print_function import collections @@ -25,7 +28,7 @@ class ExperimentStatus(object): bar_length = 50 done_char = '>' undone_char = ' ' - num_complete_chars = bar_length * num_complete / num_total + num_complete_chars = bar_length * num_complete // num_total num_undone_chars = bar_length - num_complete_chars ret += ' [%s%s]' % (num_complete_chars * done_char, num_undone_chars * undone_char) @@ -42,8 +45,8 @@ class ExperimentStatus(object): if self.completed != self.experiment.num_complete: self.completed = self.experiment.num_complete self.new_job_start_time = current_time - time_completed_jobs = (elapsed_time - - (current_time - self.new_job_start_time)) + time_completed_jobs = ( + elapsed_time - (current_time - self.new_job_start_time)) # eta is calculated as: # ETA = (num_jobs_not_yet_started * estimated_time_per_job) # + time_left_for_current_job @@ -64,10 +67,11 @@ class ExperimentStatus(object): # first long job, after a series of short jobs). For now, if that # happens, we set the ETA to "Unknown." # - eta_seconds = (float(self.num_total - self.experiment.num_complete - 1) * - time_completed_jobs / self.experiment.num_run_complete + - (time_completed_jobs / self.experiment.num_run_complete - - (current_time - self.new_job_start_time))) + eta_seconds = ( + float(self.num_total - self.experiment.num_complete - 1) * + time_completed_jobs / self.experiment.num_run_complete + + (time_completed_jobs / self.experiment.num_run_complete - + (current_time - self.new_job_start_time))) eta_seconds = int(eta_seconds) if eta_seconds > 0: @@ -91,7 +95,7 @@ class ExperimentStatus(object): status_bins[benchmark_run.timeline.GetLastEvent()].append(benchmark_run) status_strings = [] - for key, val in status_bins.iteritems(): + for key, val in status_bins.items(): if key == 'RUNNING': get_description = self._GetNamesAndIterations else: @@ -129,16 +133,16 @@ class ExperimentStatus(object): grouped_benchmarks[benchmark_run.label.name].append(benchmark_run) output_segs = [] - for label_name, label_runs in grouped_benchmarks.iteritems(): + for label_name, label_runs in grouped_benchmarks.items(): strings = [] benchmark_iterations = collections.defaultdict(list) for benchmark_run in label_runs: assert benchmark_run.label.name == label_name benchmark_name = benchmark_run.benchmark.name benchmark_iterations[benchmark_name].append(benchmark_run.iteration) - for key, val in benchmark_iterations.iteritems(): + for key, val in benchmark_iterations.items(): val.sort() - iterations = ','.join(map(str, val)) + iterations = ','.join(str(v) for v in val) strings.append('{} [{}]'.format(key, iterations)) output_segs.append(' ' + label_name + ': ' + ', '.join(strings) + '\n') |