summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 10:10:09 +0000
committerepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 10:10:09 +0000
commit6796617515596dad1d4b71cc5903000175ab7feb (patch)
treedfbdd00b6def8e246648c661a348e4e981c27db3 /tools
parent496b17652cf49839652fde74c1bf169a80e5f922 (diff)
downloadchromium_src-6796617515596dad1d4b71cc5903000175ab7feb.zip
chromium_src-6796617515596dad1d4b71cc5903000175ab7feb.tar.gz
chromium_src-6796617515596dad1d4b71cc5903000175ab7feb.tar.bz2
Telemetry: Fix timeline frame counting on Mac
We want to count the last the last swap in the embedding chain. Usually there is a hardware swap for this but on mac there doesn't appear to be one. This uses the decoder swap for now until we know the canonical swap call and add a trace there. TBR=nduca@chromium.org NOTRY=true No-try since this is blocking this from working on the mac and I've run the tests locally. Review URL: https://codereview.chromium.org/141163004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/metrics/timeline.py33
-rw-r--r--tools/perf/metrics/timeline_unittest.py2
2 files changed, 22 insertions, 13 deletions
diff --git a/tools/perf/metrics/timeline.py b/tools/perf/metrics/timeline.py
index da11b94..3f46de8 100644
--- a/tools/perf/metrics/timeline.py
+++ b/tools/perf/metrics/timeline.py
@@ -149,6 +149,13 @@ FastPathDetails = NoThreads
SilkResults = ["renderer_main", "total_all"]
SilkDetails = MainThread
+# TODO(epenner): Thread names above are likely fairly stable but trace names
+# could change. We should formalize this trace to keep this robust.
+GpuFrameTraceName = ":RealSwapBuffers"
+# TODO(epenner): The decoder swap-buffers can be used by several producers.
+# we need to find the canonical swap buffers on Mac.
+GpuFrameTraceNameMac = "GLES2DecoderImpl::DoSwapBuffers"
+
def ThreadCategoryName(thread_name):
thread_category = "other"
for substring, category in TimelineThreadCategories.iteritems():
@@ -226,20 +233,14 @@ class ThreadTimesTimelineMetric(TimelineMetric):
self.results_to_report = AllThreads
self.details_to_report = NoThreads
- def CalcFrameCount(self):
- gpu_swaps = 0
- for thread in self._model.GetAllThreads():
- if (ThreadCategoryName(thread.name) == "GPU"):
- for event in thread.IterAllSlices():
- if ":RealSwapBuffers" in event.name:
- gpu_swaps += 1
- return gpu_swaps
+ def CountSlices(self, slices, substring):
+ count = 0
+ for event in slices:
+ if substring in event.name:
+ count += 1
+ return count
def AddResults(self, tab, results):
- num_frames = self.CalcFrameCount()
- if not num_frames:
- raise MissingFramesError()
-
# Set up each thread category for consistant results.
thread_category_results = {}
for name in TimelineThreadCategories.values():
@@ -259,6 +260,14 @@ class ThreadTimesTimelineMetric(TimelineMetric):
if ThreadCategoryName(thread.name) in FastPath:
thread_category_results['total_fast_path'].AppendThreadSlices(thread)
+ # Calculate the number of frames from the GPU thread.
+ gpu_slices = thread_category_results['GPU'].all_slices
+ num_frames = self.CountSlices(gpu_slices, GpuFrameTraceName)
+ if not num_frames:
+ num_frames = self.CountSlices(gpu_slices, GpuFrameTraceNameMac)
+ if not num_frames:
+ raise MissingFramesError()
+
# Report the desired results and details.
for thread_results in thread_category_results.values():
if thread_results.name in self.results_to_report:
diff --git a/tools/perf/metrics/timeline_unittest.py b/tools/perf/metrics/timeline_unittest.py
index 1d30485..c327956 100644
--- a/tools/perf/metrics/timeline_unittest.py
+++ b/tools/perf/metrics/timeline_unittest.py
@@ -78,7 +78,7 @@ class ThreadTimesTimelineMetricUnittest(unittest.TestCase):
# Create two frame swaps (Results times should be divided by two)
gpu_main = model.GetOrCreateProcess(1).GetOrCreateThread(3)
- gpu_main.name = 'CrGPUMain'
+ gpu_main.name = 'CrGpuMain'
gpu_main.BeginSlice('gpucat', ':RealSwapBuffers', 10, 10)
gpu_main.EndSlice(11, 11)
gpu_main.BeginSlice('gpucat', ':RealSwapBuffers', 12, 12)