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

Side by Side Diff: tools/telemetry/telemetry/core/timeline/thread.py

Issue 132433004: Collecting LatencyInfo in telemetry (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 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
OLDNEW
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 import itertools 4 import itertools
5 5
6 import telemetry.core.timeline.event_container as event_container 6 import telemetry.core.timeline.event_container as event_container
7 import telemetry.core.timeline.sample as tracing_sample 7 import telemetry.core.timeline.sample as tracing_sample
8 import telemetry.core.timeline.slice as tracing_slice 8 import telemetry.core.timeline.slice as tracing_slice
9 9
10 class Thread(event_container.TimelineEventContainer): 10 class Thread(event_container.TimelineEventContainer):
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 for s in self.IterAllSlices(): 57 for s in self.IterAllSlices():
58 if s.name == name: 58 if s.name == name:
59 yield s 59 yield s
60 60
61 def IterAllAsyncSlices(self): 61 def IterAllAsyncSlices(self):
62 for async_slice in self._async_slices: 62 for async_slice in self._async_slices:
63 yield async_slice 63 yield async_slice
64 for sub_slice in async_slice.IterEventsInThisContainerRecrusively(): 64 for sub_slice in async_slice.IterEventsInThisContainerRecrusively():
65 yield sub_slice 65 yield sub_slice
66 66
67 def IterAllAsyncSlicesOfName(self, name):
68 for s in self.IterAllAsyncSlices():
69 if s.name == name:
70 yield s
71
67 def IterEventsInThisContainer(self): 72 def IterEventsInThisContainer(self):
68 return itertools.chain( 73 return itertools.chain(
69 iter(self._newly_added_slices), 74 iter(self._newly_added_slices),
70 self.IterAllAsyncSlices(), 75 self.IterAllAsyncSlices(),
71 self.IterAllSlices(), 76 self.IterAllSlices(),
72 iter(self._samples) 77 iter(self._samples)
73 ) 78 )
74 79
75 def AddSample(self, category, name, timestamp, args=None): 80 def AddSample(self, category, name, timestamp, args=None):
76 if len(self._samples) and timestamp < self._samples[-1].start: 81 if len(self._samples) and timestamp < self._samples[-1].start:
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 # (whose end = start + duration) at the same time may become not equal. 242 # (whose end = start + duration) at the same time may become not equal.
238 # Tolerate 1ps error for slice.end. 243 # Tolerate 1ps error for slice.end.
239 if child.start >= root.start and child.end - root.end < 1e-9: 244 if child.start >= root.start and child.end - root.end < 1e-9:
240 if len(root.sub_slices) > 0: 245 if len(root.sub_slices) > 0:
241 if self._AddSliceIfBounds(root.sub_slices[-1], child): 246 if self._AddSliceIfBounds(root.sub_slices[-1], child):
242 return True 247 return True
243 child.parent_slice = root 248 child.parent_slice = root
244 root.AddSubSlice(child) 249 root.AddSubSlice(child)
245 return True 250 return True
246 return False 251 return False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698