Chromium Code Reviews| Index: tools/perf/metrics/timeline.py |
| diff --git a/tools/perf/metrics/timeline.py b/tools/perf/metrics/timeline.py |
| index 01cd130c46c9c914b2e0082a60575db8bdb6054c..786234628657d8e5ccbc57aa014f948772af83ea 100644 |
| --- a/tools/perf/metrics/timeline.py |
| +++ b/tools/perf/metrics/timeline.py |
| @@ -140,8 +140,8 @@ TimelineThreadCategories = { |
| "Chrome_InProcGpuThread": "GPU", |
| "CrGpuMain" : "GPU", |
| "AsyncTransferThread" : "GPU_transfer", |
| - "CrBrowserMain" : "browser_main", |
| - "Browser Compositor" : "browser_compositor", |
| + "CrBrowserMain" : "browser", |
| + "Browser Compositor" : "browser", |
| "CrRendererMain" : "renderer_main", |
| "Compositor" : "renderer_compositor", |
| "IOThread" : "IO", |
| @@ -155,20 +155,34 @@ MatchBySubString = ["IOThread", "CompositorRasterWorker"] |
| AllThreads = TimelineThreadCategories.values() |
| NoThreads = [] |
| -FastPathThreads = ["GPU", |
| - "browser_main", |
| - "browser_compositor", |
| - "renderer_compositor", |
| - "IO"] |
| -MainThread = ["renderer_main"] |
| + |
| +FastPathThreads = ["GPU", "renderer_compositor", "browser", "IO"] |
| FastPathResults = AllThreads |
| FastPathDetails = NoThreads |
| SilkResults = ["renderer_main", "total_all"] |
| -SilkDetails = MainThread |
| +SilkDetails = ["renderer_main"] |
| # TODO(epenner): Thread names above are likely fairly stable but trace names |
| -# could change. We should formalize this trace to keep this robust. |
| -CompositorFrameTraceName = "::SwapBuffers" |
| +# could change. We should formalize these traces to keep this robust. |
| +OverheadTraceCategory = "trace_event_overhead" |
|
nduca
2014/02/05 00:34:11
global vars sould be prefixed with _ when not inte
|
| +OverheadTraceName = "overhead" |
| +FrameTraceName = "::SwapBuffers" |
| +FrameTraceThread = "renderer_compositor" |
| + |
| +def ClockOverhead(event): |
|
nduca
2014/02/05 00:34:11
GetClockOverheadFromEvent
|
| + if (event.category == OverheadTraceCategory and |
| + event.name == OverheadTraceName): |
| + return event.duration |
| + else: |
| + return 0 |
| + |
| +def CpuOverhead(event): |
|
nduca
2014/02/05 00:34:11
GetCpuOverheadFromEvent or someting like that
|
| + if (event.category == OverheadTraceCategory and |
| + event.name == OverheadTraceName and |
| + event.thread_duration): |
| + return event.thread_duration |
| + else: |
| + return 0 |
| def ThreadCategoryName(thread_name): |
| thread_category = "other" |
| @@ -198,11 +212,14 @@ class ResultsForThread(object): |
| @property |
| def clock_time(self): |
| - return sum([x.duration for x in self.toplevel_slices]) |
| + clock_duration = sum([x.duration for x in self.toplevel_slices]) |
| + clock_overhead = sum([ClockOverhead(x) for x in self.all_slices]) |
| + return clock_duration - clock_overhead |
| @property |
| def cpu_time(self): |
| - res = 0 |
| + cpu_duration = 0 |
| + cpu_overhead = sum([CpuOverhead(x) for x in self.all_slices]) |
| for x in self.toplevel_slices: |
| # Only report thread-duration if we have it for all events. |
| # |
| @@ -213,8 +230,8 @@ class ResultsForThread(object): |
| else: |
| return 0 |
| else: |
| - res += x.thread_duration |
| - return res |
| + cpu_duration += x.thread_duration |
| + return cpu_duration - cpu_overhead |
| def ActionSlices(self, slices): |
| slices_in_actions = [] |
| @@ -293,9 +310,9 @@ class ThreadTimesTimelineMetric(TimelineMetric): |
| if ThreadCategoryName(thread.name) in FastPathThreads: |
| thread_category_results['total_fast_path'].AppendThreadSlices(thread) |
| - # Calculate the number of frames from the CC thread. |
| - cc_slices = thread_category_results['renderer_compositor'].all_slices |
| - num_frames = self.CountSlices(cc_slices, CompositorFrameTraceName) |
| + # Calculate the number of frames. |
| + frame_slices = thread_category_results[FrameTraceThread].all_slices |
| + num_frames = self.CountSlices(frame_slices, FrameTraceName) |
| # Report the desired results and details. |
| for thread_results in thread_category_results.values(): |