| OLD | NEW |
| (Empty) |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import json | |
| 6 | |
| 7 from telemetry.timeline.timeline_data import TimelineData | |
| 8 | |
| 9 | |
| 10 class SurfaceFlingerTimelineData(TimelineData): | |
| 11 def __init__(self, pid, refresh_period, timestamps): | |
| 12 super(SurfaceFlingerTimelineData, self).__init__() | |
| 13 self._events = [] | |
| 14 for ts in timestamps: | |
| 15 self._events.append( | |
| 16 {'cat': 'SurfaceFlinger', | |
| 17 'name': 'vsync_before', | |
| 18 'ts': ts, | |
| 19 'pid': pid, | |
| 20 'tid': pid, | |
| 21 'args': {'data': {'frame_count': 1, | |
| 22 'refresh_period': refresh_period}}}) | |
| 23 | |
| 24 def Serialize(self, f): | |
| 25 """Serializes the surface flinger data to a file-like object""" | |
| 26 json.dump(self._events, f, indent=4) | |
| 27 | |
| 28 def EventData(self): | |
| 29 return self._events | |
| OLD | NEW |