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

Side by Side Diff: tools/telemetry/telemetry/core/timeline/tracing/slice.py

Issue 19772005: [telemetry] Timeline model cleanups (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2013 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 telemetry.core.timeline.event as timeline_event
6
7 class Slice(timeline_event.TimelineEvent):
8 ''' A Slice represents an interval of time plus parameters associated
9 with that interval.
10
11 NOTE: The Sample class implements the same interface as
12 Slice. These must be kept in sync.
13
14 All time units are stored in milliseconds.
15 '''
16 def __init__(self, category, name, timestamp, args=None, parent=None):
17 super(Slice, self).__init__(
18 name, timestamp, 0, args=args, parent=parent)
19 self._sub_slices = []
20 self.category = category
21 self.did_not_finish = False
22
23 @property
24 def sub_slices(self):
25 return self._sub_slices
26
27 def AddSubSlice(self, sub_slice):
28 self._sub_slices.append(sub_slice)
29
30 def _GetSubSlicesRecursive(self):
31 for sub_slice in self._sub_slices:
32 for s in sub_slice.GetAllSubSlices():
33 yield s
34 yield sub_slice
35
36 def GetAllSubSlices(self):
37 return list(self._GetSubSlicesRecursive())
38
39 def GetAllSubSlicesOfName(self, name):
40 return [e for e in self.GetAllSubSlices() if e.name == name]
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/timeline/tracing/sample.py ('k') | tools/telemetry/telemetry/core/timeline/tracing/thread.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698