Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Unified Diff: tools/perf/metrics/cpu_unittest.py

Issue 362533003: Fix overflow for 32-bit jiffie counter on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/metrics/cpu.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/cpu_unittest.py
diff --git a/tools/perf/metrics/cpu_unittest.py b/tools/perf/metrics/cpu_unittest.py
index 30d488dac8bc420399e00f32ea8a6fff6b8277d0..6c7f893d0a18a6582a129bc1f18d4072ca3ca1f7 100644
--- a/tools/perf/metrics/cpu_unittest.py
+++ b/tools/perf/metrics/cpu_unittest.py
@@ -31,3 +31,9 @@ class CpuMetricTest(unittest.TestCase):
self.assertEqual({'Browser': 0.25, 'Renderer': 0.1},
cpu._SubtractCpuStats(end, start))
+ # Test 32-bit overflow.
+ start = {'Browser': {'CpuProcessTime': 0, 'TotalTime': 2**32 - 20}}
+ end = {'Browser': {'CpuProcessTime': 5, 'TotalTime': 20}}
+ self.assertEqual({'Browser': 0.125}, cpu._SubtractCpuStats(end, start))
+ self.assertRaises(AssertionError, cpu._SubtractCpuStats, start, end)
+
« no previous file with comments | « tools/perf/metrics/cpu.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698