Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import telemetry.core.timeline.tracing.slice as tracing_slice | 5 import telemetry.core.timeline.event as event |
| 6 | 6 |
| 7 class AsyncSlice(tracing_slice.Slice): | 7 class AsyncSlice(event.TimelineEvent): |
| 8 ''' A AsyncSlice represents an interval of time during which an | 8 ''' A AsyncSlice represents an interval of time during which an |
| 9 asynchronous operation is in progress. An AsyncSlice consumes no CPU time | 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. | 10 itself and so is only associated with Threads at its start and end point. |
| 11 ''' | 11 ''' |
| 12 def __init__(self, category, name, timestamp, args=None, parent=None): | 12 def __init__(self, category, name, timestamp, args=None): |
| 13 super(AsyncSlice, self).__init__( | 13 super(AsyncSlice, self).__init__( |
| 14 category, name, timestamp, args=args, parent=parent) | 14 category, name, timestamp, duration=0, args=args) |
| 15 self.parent_slice = None | |
| 15 self.start_thread = None | 16 self.start_thread = None |
| 16 self.end_thread = None | 17 self.end_thread = None |
| 18 self.sub_slices = [] | |
| 17 self.id = None | 19 self.id = None |
| 18 | 20 |
| 19 def AddSubSlice(self, sub_slice): | 21 def AddSubSlice(self, sub_slice): |
|
Tim Song
2013/07/18 22:56:36
We should just assign the parent_slice here instea
nduca
2013/07/18 23:03:40
No.
| |
| 20 super(AsyncSlice, self).AddSubSlice(sub_slice) | 22 assert sub_slice.parent_slice == self |
| 21 self.children.append(sub_slice) | 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 | |
| OLD | NEW |