Commit aa52489e authored by skyostil@chromium.org's avatar skyostil@chromium.org

telemetry: Use trace categories to configure synthetic delays

BUG=307841
TEST=tools/perf/run_benchmark scheduler.tough_scheduling_cases

Review URL: https://codereview.chromium.org/103143007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243993 0039d316-1c4b-4281-b951-d872f2087c98
parent 234ceced
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from measurements import smoothness
class SchedulerToughSchedulingCases(test.Test):
"""Measures rendering statistics while interacting with pages that have
challenging scheduling properties.
https://docs.google.com/a/chromium.org/document/d/
17yhE5Po9By0sCdM1yZT3LiUECaUr_94rQt9j-4tOQIM/view"""
test = smoothness.Smoothness
page_set = 'page_sets/tough_scheduling_cases.json'
...@@ -29,13 +29,3 @@ class SmoothnessKeyMobileSites(test.Test): ...@@ -29,13 +29,3 @@ class SmoothnessKeyMobileSites(test.Test):
http://www.chromium.org/developers/design-documents/rendering-benchmarks""" http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
test = smoothness.Smoothness test = smoothness.Smoothness
page_set = 'page_sets/key_mobile_sites.json' page_set = 'page_sets/key_mobile_sites.json'
class SmoothnessToughSchedulingCases(test.Test):
"""Measures rendering statistics while interacting with pages that have
challenging scheduling properties.
https://docs.google.com/a/chromium.org/document/d/
17yhE5Po9By0sCdM1yZT3LiUECaUr_94rQt9j-4tOQIM/view"""
test = smoothness.Smoothness
page_set = 'page_sets/tough_scheduling_cases.json'
...@@ -27,6 +27,17 @@ class NoSupportedActionError(page_measurement.MeasurementFailure): ...@@ -27,6 +27,17 @@ class NoSupportedActionError(page_measurement.MeasurementFailure):
'None of the actions is supported by smoothness measurement') 'None of the actions is supported by smoothness measurement')
def _GetSyntheticDelayCategoriesFromPage(page):
if not hasattr(page, 'synthetic_delays'):
return []
result = []
for delay, options in page.synthetic_delays.items():
options = '%f;%s' % (options.get('target_duration', 0),
options.get('mode', 'static'))
result.append('DELAY(%s;%s)' % (delay, options))
return result
class SmoothnessMetric(Metric): class SmoothnessMetric(Metric):
def __init__(self): def __init__(self):
super(SmoothnessMetric, self).__init__() super(SmoothnessMetric, self).__init__()
...@@ -37,7 +48,9 @@ class SmoothnessMetric(Metric): ...@@ -37,7 +48,9 @@ class SmoothnessMetric(Metric):
self._actions.append(action) self._actions.append(action)
def Start(self, page, tab): def Start(self, page, tab):
tab.browser.StartTracing('webkit.console,benchmark', 60) custom_categories = ['webkit.console', 'benchmark']
custom_categories += _GetSyntheticDelayCategoriesFromPage(page)
tab.browser.StartTracing(','.join(custom_categories), 60)
tab.ExecuteJavaScript('console.time("' + TIMELINE_MARKER + '")') tab.ExecuteJavaScript('console.time("' + TIMELINE_MARKER + '")')
if tab.browser.platform.IsRawDisplayFrameRateSupported(): if tab.browser.platform.IsRawDisplayFrameRateSupported():
tab.browser.platform.StartRawDisplayFrameRateMeasurement() tab.browser.platform.StartRawDisplayFrameRateMeasurement()
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from metrics import smoothness
from telemetry.page import page
class FakePlatform(object):
def IsRawDisplayFrameRateSupported(self):
return False
class FakeBrowser(object):
def __init__(self):
self.platform = FakePlatform()
self.category_filter = None
def StartTracing(self, category_filter, _):
self.category_filter = category_filter
class FakeTab(object):
def __init__(self):
self.browser = FakeBrowser()
def ExecuteJavaScript(self, js):
pass
class SmoothnessMetricUnitTest(unittest.TestCase):
def testSyntheticDelayConfiguration(self):
attributes = {
'synthetic_delays': {
'cc.BeginMainFrame': { 'target_duration': 0.012 },
'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' },
'gpu.SwapBuffers': { 'target_duration': 0.012 }
}
}
test_page = page.Page('http://dummy', None, attributes=attributes)
tab = FakeTab()
smoothness_metric = smoothness.SmoothnessMetric()
smoothness_metric.Start(test_page, tab)
expected_category_filter = [
'DELAY(cc.BeginMainFrame;0.012000;static)',
'DELAY(cc.DrawAndSwap;0.012000;alternating)',
'DELAY(gpu.SwapBuffers;0.012000;static)',
'benchmark',
'webkit.console'
]
self.assertEquals(expected_category_filter,
sorted(tab.browser.category_filter.split(',')))
...@@ -6,261 +6,156 @@ ...@@ -6,261 +6,156 @@
"pages": [ "pages": [
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html", "url": "file://tough_scheduling_cases/simple_text_page.html",
"why": "Simple scrolling baseline", "why": "Simple scrolling baseline"
"navigate_steps": [
{ "action": "navigate" },
{ "action": "set_synthetic_delays" }
]
}, },
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html?main_busy", "url": "file://tough_scheduling_cases/simple_text_page.html?main_busy",
"why": "Simulate oversubscribed main thread", "why": "Simulate oversubscribed main thread",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.008 } "cc.BeginMainFrame": { "target_duration": 0.008 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html?main_very_busy", "url": "file://tough_scheduling_cases/simple_text_page.html?main_very_busy",
"why": "Simulate oversubscribed main thread", "why": "Simulate oversubscribed main thread",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.024 } "cc.BeginMainFrame": { "target_duration": 0.024 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html?medium_layers", "url": "file://tough_scheduling_cases/simple_text_page.html?medium_layers",
"why": "Simulate a page with a a few graphics layers", "why": "Simulate a page with a a few graphics layers",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.004 }, "cc.BeginMainFrame": { "target_duration": 0.004 },
"cc.DrawAndSwap": { "target_duration": 0.004 }, "cc.DrawAndSwap": { "target_duration": 0.004 },
"gpu.SwapBuffers": { "target_duration": 0.004 } "gpu.SwapBuffers": { "target_duration": 0.004 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html?many_layers", "url": "file://tough_scheduling_cases/simple_text_page.html?many_layers",
"why": "Simulate a page with many graphics layers", "why": "Simulate a page with many graphics layers",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.012 }, "cc.BeginMainFrame": { "target_duration": 0.012 },
"cc.DrawAndSwap": { "target_duration": 0.012 }, "cc.DrawAndSwap": { "target_duration": 0.012 },
"gpu.SwapBuffers": { "target_duration": 0.012 } "gpu.SwapBuffers": { "target_duration": 0.012 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html?medium_raster", "url": "file://tough_scheduling_cases/simple_text_page.html?medium_raster",
"why": "Simulate a page with expensive recording and rasterization", "why": "Simulate a page with expensive recording and rasterization",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.004 }, "cc.BeginMainFrame": { "target_duration": 0.004 },
"cc.RasterRequiredForActivation": { "target_duration": 0.004 }, "cc.RasterRequiredForActivation": { "target_duration": 0.004 },
"gpu.AsyncTexImage": { "target_duration": 0.004 } "gpu.AsyncTexImage": { "target_duration": 0.004 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/simple_text_page.html?heavy_raster", "url": "file://tough_scheduling_cases/simple_text_page.html?heavy_raster",
"why": "Simulate a page with expensive recording and rasterization", "why": "Simulate a page with expensive recording and rasterization",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.024 }, "cc.BeginMainFrame": { "target_duration": 0.024 },
"cc.RasterRequiredForActivation": { "target_duration": 0.024 }, "cc.RasterRequiredForActivation": { "target_duration": 0.024 },
"gpu.AsyncTexImage": { "target_duration": 0.024 } "gpu.AsyncTexImage": { "target_duration": 0.024 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/touch_handler_scrolling.html", "url": "file://tough_scheduling_cases/touch_handler_scrolling.html",
"why": "Touch handler scrolling baseline", "why": "Touch handler scrolling baseline"
"navigate_steps": [
{ "action": "navigate" },
{ "action": "set_synthetic_delays" }
]
}, },
{ {
"url": "file://tough_scheduling_cases/touch_handler_scrolling.html?medium_handler", "url": "file://tough_scheduling_cases/touch_handler_scrolling.html?medium_handler",
"why": "Medium cost touch handler", "why": "Medium cost touch handler",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"blink.HandleInputEvent": { "target_duration": 0.008 } "blink.HandleInputEvent": { "target_duration": 0.008 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/touch_handler_scrolling.html?slow_handler", "url": "file://tough_scheduling_cases/touch_handler_scrolling.html?slow_handler",
"why": "Slow touch handler", "why": "Slow touch handler",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"blink.HandleInputEvent": { "target_duration": 0.024 } "blink.HandleInputEvent": { "target_duration": 0.024 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/touch_handler_scrolling.html?janky_handler", "url": "file://tough_scheduling_cases/touch_handler_scrolling.html?janky_handler",
"why": "Touch handler that often takes a long time", "why": "Touch handler that often takes a long time",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"blink.HandleInputEvent": { "target_duration": 0.024, "mode": "alternating" } "blink.HandleInputEvent": { "target_duration": 0.024, "mode": "alternating" }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/touch_handler_scrolling.html?occasionally_janky_handler", "url": "file://tough_scheduling_cases/touch_handler_scrolling.html?occasionally_janky_handler",
"why": "Touch handler that occasionally takes a long time", "why": "Touch handler that occasionally takes a long time",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"blink.HandleInputEvent": { "target_duration": 0.024, "mode": "oneshot" } "blink.HandleInputEvent": { "target_duration": 0.024, "mode": "oneshot" }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/touch_handler_scrolling.html?super_slow_handler", "url": "file://tough_scheduling_cases/touch_handler_scrolling.html?super_slow_handler",
"why": "Super expensive touch handler causes browser to scroll after a timeout", "why": "Super expensive touch handler causes browser to scroll after a timeout",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"blink.HandleInputEvent": { "target_duration": 0.2 } "blink.HandleInputEvent": { "target_duration": 0.2 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/div_touch_handler.html", "url": "file://tough_scheduling_cases/div_touch_handler.html",
"why": "Super expensive touch handler that only occupies a part of the page", "why": "Super expensive touch handler that only occupies a part of the page",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"blink.HandleInputEvent": { "target_duration": 0.2 } "blink.HandleInputEvent": { "target_duration": 0.2 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf.html", "url": "file://tough_scheduling_cases/raf.html",
"why": "requestAnimationFrame scrolling baseline", "why": "requestAnimationFrame scrolling baseline"
"navigate_steps": [
{ "action": "navigate" },
{ "action": "set_synthetic_delays" }
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf_canvas.html", "url": "file://tough_scheduling_cases/raf_canvas.html",
"why": "Test canvas blocking behavior", "why": "Test canvas blocking behavior"
"navigate_steps": [
{ "action": "navigate" },
{ "action": "set_synthetic_delays" }
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf.html?medium_handler", "url": "file://tough_scheduling_cases/raf.html?medium_handler",
"why": "Test a moderately heavy requestAnimationFrame handler", "why": "Test a moderately heavy requestAnimationFrame handler",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.004 }, "cc.BeginMainFrame": { "target_duration": 0.004 },
"cc.RasterRequiredForActivation": { "target_duration": 0.004 }, "cc.RasterRequiredForActivation": { "target_duration": 0.004 },
"gpu.AsyncTexImage": { "target_duration": 0.004 } "gpu.AsyncTexImage": { "target_duration": 0.004 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf.html?heavy_handler", "url": "file://tough_scheduling_cases/raf.html?heavy_handler",
"why": "Test a moderately heavy requestAnimationFrame handler", "why": "Test a moderately heavy requestAnimationFrame handler",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.024 }, "cc.BeginMainFrame": { "target_duration": 0.024 },
"cc.RasterRequiredForActivation": { "target_duration": 0.024 }, "cc.RasterRequiredForActivation": { "target_duration": 0.024 },
"gpu.AsyncTexImage": { "target_duration": 0.024 } "gpu.AsyncTexImage": { "target_duration": 0.024 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf.html?gpu_bound", "url": "file://tough_scheduling_cases/raf.html?gpu_bound",
"why": "Simulate a heavily GPU bound page", "why": "Simulate a heavily GPU bound page",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"gpu.SwapBuffers": { "target_duration": 0.1 } "gpu.SwapBuffers": { "target_duration": 0.1 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf_touch_animation.html", "url": "file://tough_scheduling_cases/raf_touch_animation.html",
"why": "Stress test for the scheduler", "why": "Stress test for the scheduler"
"navigate_steps": [
{ "action": "navigate" },
{ "action": "set_synthetic_delays" }
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf_touch_animation.html?medium", "url": "file://tough_scheduling_cases/raf_touch_animation.html?medium",
"why": "Medium stress test for the scheduler", "why": "Medium stress test for the scheduler",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.004 }, "cc.BeginMainFrame": { "target_duration": 0.004 },
"cc.DrawAndSwap": { "target_duration": 0.004 } "cc.DrawAndSwap": { "target_duration": 0.004 }
} }
}
]
}, },
{ {
"url": "file://tough_scheduling_cases/raf_touch_animation.html?heavy", "url": "file://tough_scheduling_cases/raf_touch_animation.html?heavy",
"why": "Heavy stress test for the scheduler", "why": "Heavy stress test for the scheduler",
"navigate_steps": [ "synthetic_delays": {
{ "action": "navigate" },
{ "action": "set_synthetic_delays",
"delays": {
"cc.BeginMainFrame": { "target_duration": 0.012 }, "cc.BeginMainFrame": { "target_duration": 0.012 },
"cc.DrawAndSwap": { "target_duration": 0.012 } "cc.DrawAndSwap": { "target_duration": 0.012 }
} }
} }
] ]
}
]
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment