- add sources.
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / timeline / async_slice.py
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 event
6
7 class AsyncSlice(event.TimelineEvent):
8   ''' A AsyncSlice represents an interval of time during which an
9   asynchronous operation is in progress. An AsyncSlice consumes no CPU time
10   itself and so is only associated with Threads at its start and end point.
11   '''
12   def __init__(self, category, name, timestamp, args=None):
13     super(AsyncSlice, self).__init__(
14         category, name, timestamp, duration=0, args=args)
15     self.parent_slice = None
16     self.start_thread = None
17     self.end_thread = None
18     self.sub_slices = []
19     self.id = None
20
21   def AddSubSlice(self, sub_slice):
22     assert sub_slice.parent_slice == self
23     self.sub_slices.append(sub_slice)
24
25
26   def IterEventsInThisContainerRecrusively(self):
27     for sub_slice in self.sub_slices:
28       yield sub_slice