| 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.event as event | 5 import telemetry.core.timeline.event as event |
| 6 | 6 |
| 7 class AsyncSlice(event.TimelineEvent): | 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): | 12 def __init__(self, category, name, timestamp, args=None, |
| 13 duration=0, start_thread=None, end_thread=None): |
| 13 super(AsyncSlice, self).__init__( | 14 super(AsyncSlice, self).__init__( |
| 14 category, name, timestamp, duration=0, args=args) | 15 category, name, timestamp, duration=duration, args=args) |
| 15 self.parent_slice = None | 16 self.parent_slice = None |
| 16 self.start_thread = None | 17 self.start_thread = start_thread |
| 17 self.end_thread = None | 18 self.end_thread = end_thread |
| 18 self.sub_slices = [] | 19 self.sub_slices = [] |
| 19 self.id = None | 20 self.id = None |
| 20 | 21 |
| 21 def AddSubSlice(self, sub_slice): | 22 def AddSubSlice(self, sub_slice): |
| 22 assert sub_slice.parent_slice == self | 23 assert sub_slice.parent_slice == self |
| 23 self.sub_slices.append(sub_slice) | 24 self.sub_slices.append(sub_slice) |
| 24 | 25 |
| 25 | 26 |
| 26 def IterEventsInThisContainerRecrusively(self): | 27 def IterEventsInThisContainerRecrusively(self): |
| 27 for sub_slice in self.sub_slices: | 28 for sub_slice in self.sub_slices: |
| 28 yield sub_slice | 29 yield sub_slice |
| OLD | NEW |