New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 796212 link

Starred by 2 users

Issue metadata

Status: Verified
Closed: Dec 2017
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Sign in to add a comment

graphics_Idle - Unhandled ZeroDivisionError: float division by zero

Reported by, Dec 19 2017

Issue description

This paladin run failed:

The failure was because of this test:

That test failed because of this:
Traceback (most recent call last):
  File "/usr/local/autotest/common_lib/", line 831, in _call_test_function
    return func(*args, **dargs)
  File "/usr/local/autotest/common_lib/", line 495, in execute
  File "/usr/local/autotest/common_lib/", line 362, in _call_run_once_with_retry
    postprocess_profiled_run, args, dargs)
  File "/usr/local/autotest/common_lib/", line 400, in _call_run_once
    self.run_once(*args, **dargs)
  File "/usr/local/autotest/tests/graphics_Idle/", line 48, in run_once
    if not utils.wait_for_idle_cpu(20.0, 0.1):
  File "/usr/local/autotest/bin/", line 1640, in wait_for_idle_cpu
    compute_active_cpu_time(cpu_usage_start, cpu_usage_end)
  File "/usr/local/autotest/bin/", line 1612, in compute_active_cpu_time
    (total_time_end - total_time_start))
ZeroDivisionError: float division by zero

Here's the source code around the failure:
    def compute_active_cpu_time(cpu_usage_start, cpu_usage_end):
        idle_cols = ('idle', 'iowait')  # All other cols are calculated as active.    
        time_active_start = sum([x[1] for x in cpu_usage_start.iteritems()
                                 if x[0] not in idle_cols])
        time_active_end = sum([x[1] for x in cpu_usage_end.iteritems()
                               if x[0] not in idle_cols])
        total_time_start = sum(cpu_usage_start.values())
        total_time_end = sum(cpu_usage_end.values())
        return ((float(time_active_end) - time_active_start) /
                (total_time_end - total_time_start))

So, the error happened because the routine's estimate of "time
elapsed" was calculated to be 0.

Assigning to a sheriff to figure out who owns this test.  There's a
good chance that ihf@ knows the answer...
 Issue 796214  has been merged into this issue.
Over to ayatane@ who wrote the failing function.
I didn't write this, I probably just touched it during refactoring.
Back to bmgordon@ - talk to the graphics team to find an owner.

Comment 5 by, Dec 20 2017

Status: Started (was: Assigned)
This is exceptionally rare (and honestly not something that should be expected on a proper DUT, but then again this is Tegra). I've modified the code to avoid the division by zero.
Project Member

Comment 6 by, Dec 20 2017

The following revision refers to this bug:

commit b2b28b3f232b01901fc173adab418503b90caa09
Author: Ilja H. Friedel <>
Date: Wed Dec 20 20:53:47 2017

utils: avoid division by zero.

This is an exceptionally rare case, but has been observed once
on a Tegra Chromebook.

BUG= chromium:796212 

Change-Id: I6ddf7fecca3a6c9ab676f5a8574079ebb0dd0f23


Comment 7 by, Dec 20 2017

Status: Verified (was: Started)

Sign in to add a comment