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

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

Issue 141163004: Telemetry: Fix frame counting on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gpu Created 6 years, 11 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 | tools/perf/metrics/timeline_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/timeline.py
diff --git a/tools/perf/metrics/timeline.py b/tools/perf/metrics/timeline.py
index da11b940971a056baf37ec2a37a3bde75bd5544e..3f46de8b33649c3bf325323c6a3afc49dae88aa1 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:
« no previous file with comments | « no previous file | tools/perf/metrics/timeline_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698