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

Unified Diff: telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py

Issue 1673933003: Attempt to deflake telemetry...DevToolsStreamPerformanceTest.testReadTime (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
diff --git a/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py b/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
index dacef13280917c8bdb9439dd5a5e449bade78665..a5b98c4888c8d3e8e52577bb5c68ebc26d290cd8 100644
--- a/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
+++ b/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import time
+import timeit
import unittest
from telemetry import decorators
@@ -175,7 +175,7 @@ class DevToolsStreamPerformanceTest(unittest.TestCase):
payload = ','.join(['{}'] * 5000)
self._inspector_socket.AddAsyncResponse('IO.read', {'data': '[' + payload},
mock_time)
- startClock = time.clock()
+ startClock = timeit.default_timer()
done = {'done': False}
def mark_done(data):
@@ -194,11 +194,16 @@ class DevToolsStreamPerformanceTest(unittest.TestCase):
{'data': payload + ']', 'eof': True}, mock_time)
count -= 1
self._inspector_socket.DispatchNotifications(10)
- return time.clock() - startClock
+ return timeit.default_timer() - startClock
def testReadTime(self):
- t1k = self._MeasureReadTime(1000)
- t10k = self._MeasureReadTime(10000)
+ n1 = 1000
+ while True:
+ t1 = self._MeasureReadTime(n1)
+ if t1 > 0.01:
+ break
+ n1 *= 5
+ t2 = self._MeasureReadTime(n1 * 10)
# Time is an illusion, CPU time is doubly so, allow great deal of tolerance.
toleranceFactor = 5
- self.assertLess(t10k / t1k, 10000 / 1000 * toleranceFactor)
+ self.assertLess(t2, t1 * 10 * toleranceFactor)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698