diff options
author | cmtice <cmtice@google.com> | 2014-03-13 11:06:16 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-14 03:30:20 +0000 |
commit | 2317decf0e3f62297fc09a712bdf7fa253d560f3 (patch) | |
tree | a04bd4c2f2f2953464a2af6b31098b2d7039e096 /crosperf/experiment_status.py | |
parent | e77818d606f46e84a592702272d73715b321a773 (diff) | |
download | toolchain-utils-2317decf0e3f62297fc09a712bdf7fa253d560f3.tar.gz |
Fix Crosperf's ETA bug.
Sometimes crosperf shows a negative number for ETA. This fixes that.
BUG=None
TEST=Force the bug to happen; tested with and without the fix.
Change-Id: I0c8c909a944ad3cf25b8c5416f93ddc0b860a03d
Reviewed-on: https://chrome-internal-review.googlesource.com/157125
Reviewed-by: Han Shen <shenhan@google.com>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Commit-Queue: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf/experiment_status.py')
-rw-r--r-- | crosperf/experiment_status.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/crosperf/experiment_status.py b/crosperf/experiment_status.py index 3a270663..a9ff8edb 100644 --- a/crosperf/experiment_status.py +++ b/crosperf/experiment_status.py @@ -41,13 +41,36 @@ class ExperimentStatus(object): self.new_job_start_time = current_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 + # + # where + # num_jobs_not_yet_started = (num_total - num_complete - 1) + # + # estimated_time_per_job = time_completed_jobs / num_run_complete + # + # time_left_for_current_job = estimated_time_per_job - + # time_spent_so_far_on_current_job + # + # The biggest problem with this calculation is its assumption that + # all jobs have roughly the same running time (blatantly false!). + # + # ETA can come out negative if the time spent on the current job is + # greater than the estimated time per job (e.g. you're running the + # 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 = int(eta_seconds) - eta = datetime.timedelta(seconds=eta_seconds) + if eta_seconds > 0: + eta = datetime.timedelta(seconds=eta_seconds) + else: + eta = "Unknown" except ZeroDivisionError: eta = "Unknown" strings = [] |