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

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

Issue 145923002: Added support to listen on Network.responseReceived and expose that through tab.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (inspector_network cleanup from previous API) Created 6 years, 9 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 0: [ a ] [f] 217 0: [ a ] [f]
218 1: [ b ][e] 218 1: [ b ][e]
219 ''' 219 '''
220 def CompareSlices(s1, s2): 220 def CompareSlices(s1, s2):
221 if s1.start == s2.start: 221 if s1.start == s2.start:
222 # Break ties by having the slice with the greatest 222 # Break ties by having the slice with the greatest
223 # end timestamp come first. 223 # end timestamp come first.
224 return cmp(s2.end, s1.end) 224 return cmp(s2.end, s1.end)
225 return cmp(s1.start, s2.start) 225 return cmp(s1.start, s2.start)
226 226
227 assert len(self._toplevel_slices) == 0
tonyg 2014/03/04 05:27:31 Can you explain this?
bolian 2014/03/04 20:32:44 After moving model out of timeline recorder, I don
228 if not len(self._newly_added_slices): 227 if not len(self._newly_added_slices):
229 return 228 return
230 229
231 sorted_slices = sorted(self._newly_added_slices, cmp=CompareSlices) 230 sorted_slices = sorted(self._newly_added_slices, cmp=CompareSlices)
232 root_slice = sorted_slices[0] 231 root_slice = sorted_slices[0]
233 self._toplevel_slices.append(root_slice) 232 self._toplevel_slices.append(root_slice)
234 for s in sorted_slices[1:]: 233 for s in sorted_slices[1:]:
235 if not self._AddSliceIfBounds(root_slice, s): 234 if not self._AddSliceIfBounds(root_slice, s):
236 root_slice = s 235 root_slice = s
237 self._toplevel_slices.append(root_slice) 236 self._toplevel_slices.append(root_slice)
(...skipping 15 matching lines...) Expand all
253 child_end_micros = round(child.end * 1000) 252 child_end_micros = round(child.end * 1000)
254 root_end_micros = round(root.end * 1000) 253 root_end_micros = round(root.end * 1000)
255 if child.start >= root.start and child_end_micros <= root_end_micros: 254 if child.start >= root.start and child_end_micros <= root_end_micros:
256 if len(root.sub_slices) > 0: 255 if len(root.sub_slices) > 0:
257 if self._AddSliceIfBounds(root.sub_slices[-1], child): 256 if self._AddSliceIfBounds(root.sub_slices[-1], child):
258 return True 257 return True
259 child.parent_slice = root 258 child.parent_slice = root
260 root.AddSubSlice(child) 259 root.AddSubSlice(child)
261 return True 260 return True
262 return False 261 return False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698