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

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

Issue 1084533005: Support total and per-second task/threadtime timeline metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Precomputed expectations Created 5 years, 7 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/timeline.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/timeline_unittest.py
diff --git a/tools/perf/metrics/timeline_unittest.py b/tools/perf/metrics/timeline_unittest.py
index 5ae1a5d66fdc65e9e141fee500ae54cde962b0d2..098ceae99b3281921f426959aa74c8b45b09b2dd 100644
--- a/tools/perf/metrics/timeline_unittest.py
+++ b/tools/perf/metrics/timeline_unittest.py
@@ -109,14 +109,16 @@ class ThreadTimesTimelineMetricUnittest(unittest.TestCase):
# Test that all result thread categories exist
for name in timeline.TimelineThreadCategories.values():
- results.GetPageSpecificValueNamed(timeline.ThreadCpuTimeResultName(name))
+ results.GetPageSpecificValueNamed(
+ timeline.ThreadCpuTimeResultName(name, 'frame'))
def testBasic(self):
model = model_module.TimelineModel()
renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2)
renderer_main.name = 'CrRendererMain'
- # Create two frame swaps (Results times should be divided by two)
+ # Create two frame swaps (Results times should be divided by two) for
+ # an interaction that lasts 20 milliseconds.
cc_main = model.GetOrCreateProcess(1).GetOrCreateThread(3)
cc_main.name = 'Compositor'
cc_main.BeginSlice('cc_cat', timeline.FrameTraceName, 10, 10)
@@ -144,12 +146,25 @@ class ThreadTimesTimelineMetricUnittest(unittest.TestCase):
main_thread = "renderer_main"
cc_thread = 'renderer_compositor'
assert_results = [
- (timeline.ThreadCpuTimeResultName(main_thread), 'ms', 9.75),
- (timeline.ThreadTasksResultName(main_thread), 'tasks', 0.5),
(timeline.ThreadMeanFrameTimeResultName(cc_thread), 'ms', 10.0),
- (timeline.ThreadDetailResultName(main_thread,'cat1'), 'ms', 9.5),
- (timeline.ThreadDetailResultName(main_thread,'cat2'), 'ms', 0.5),
- (timeline.ThreadDetailResultName(main_thread,'idle'), 'ms', 0)
+ (timeline.ThreadTasksResultName(main_thread, 'frame'), 'tasks', 0.5),
+ (timeline.ThreadTasksResultName(main_thread, 'second'), 'tasks', 50.0),
+ (timeline.ThreadTasksResultName(cc_thread, 'frame'), 'tasks', 1.0),
+ (timeline.ThreadTasksResultName(cc_thread, 'second'), 'tasks', 100.0),
+ (timeline.ThreadCpuTimeResultName(main_thread, 'frame'), 'ms', 9.75),
+ (timeline.ThreadCpuTimeResultName(main_thread, 'second'), '%', 97.5),
+ (timeline.ThreadCpuTimeResultName(cc_thread, 'frame'), 'ms', 1.0),
+ (timeline.ThreadCpuTimeResultName(cc_thread, 'second'), '%', 10.0),
+ (timeline.ThreadDetailResultName(main_thread, 'frame', 'cat1'),
+ 'ms', 9.5),
+ (timeline.ThreadDetailResultName(main_thread, 'second', 'cat1'),
+ '%', 95.0),
+ (timeline.ThreadDetailResultName(main_thread, 'frame', 'cat2'),
+ 'ms', 0.5),
+ (timeline.ThreadDetailResultName(main_thread, 'second', 'cat2'),
+ '%', 5.0),
+ (timeline.ThreadDetailResultName(main_thread, 'frame', 'idle'), 'ms', 0),
+ (timeline.ThreadDetailResultName(main_thread, 'second', 'idle'), '%', 0)
]
for name, unit, value in assert_results:
results.AssertHasPageSpecificScalarValue(name, unit, value)
@@ -182,8 +197,9 @@ class ThreadTimesTimelineMetricUnittest(unittest.TestCase):
[_GetInteractionRecord(10, 30)])
# Test a couple specific results.
- assert_results = {
- timeline.ThreadCpuTimeResultName('renderer_main') : 9.0,
- }
- for name, value in assert_results.iteritems():
- results.AssertHasPageSpecificScalarValue(name, 'ms', value)
+ assert_results = [
+ (timeline.ThreadCpuTimeResultName('renderer_main', 'frame') , 'ms', 9.0),
+ (timeline.ThreadCpuTimeResultName('renderer_main', 'second') , '%', 45.0),
+ ]
+ for name, unit, value in assert_results:
+ results.AssertHasPageSpecificScalarValue(name, unit, value)
« no previous file with comments | « tools/perf/metrics/timeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698