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

Side by Side Diff: tools/android/loading/activity_lens.py

Issue 1813723002: clovis: Identify prefetchable resources from dependencies and tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « no previous file | tools/android/loading/prefetch_view.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 """Gives a picture of the CPU activity between timestamps. 5 """Gives a picture of the CPU activity between timestamps.
6 6
7 When executed as a script, takes a loading trace, and prints the activity 7 When executed as a script, takes a loading trace, and prints the activity
8 breakdown for the request dependencies. 8 breakdown for the request dependencies.
9 """ 9 """
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 def __init__(self, trace): 23 def __init__(self, trace):
24 """Initializes an instance of ActivityLens. 24 """Initializes an instance of ActivityLens.
25 25
26 Args: 26 Args:
27 trace: (LoadingTrace) loading trace. 27 trace: (LoadingTrace) loading trace.
28 """ 28 """
29 self._trace = trace 29 self._trace = trace
30 events = trace.tracing_track.GetEvents() 30 events = trace.tracing_track.GetEvents()
31 self._renderer_main_pid_tid = self._GetRendererMainThreadId(events) 31 self._renderer_main_pid_tid = self._GetRendererMainThreadId(events)
32 self._tracing = self._trace.tracing_track.TracingTrackForThread( 32 self._tracing = self._trace.tracing_track.Filter(
33 self._renderer_main_pid_tid) 33 *self._renderer_main_pid_tid)
34 34
35 @classmethod 35 @classmethod
36 def _GetRendererMainThreadId(cls, events): 36 def _GetRendererMainThreadId(cls, events):
37 """Returns the most active main renderer thread. 37 """Returns the most active main renderer thread.
38 38
39 Several renderers may be running concurrently, but we assume that only one 39 Several renderers may be running concurrently, but we assume that only one
40 of them is busy during the time covered by the loading trace.. It can be 40 of them is busy during the time covered by the loading trace.. It can be
41 selected by looking at the number of trace events generated. 41 selected by looking at the number of trace events generated.
42 42
43 Args: 43 Args:
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 filename = sys.argv[1] 276 filename = sys.argv[1]
277 json_dict = json.load(open(filename)) 277 json_dict = json.load(open(filename))
278 loading_trace = loading_trace.LoadingTrace.FromJsonDict(json_dict) 278 loading_trace = loading_trace.LoadingTrace.FromJsonDict(json_dict)
279 activity_lens = ActivityLens(loading_trace) 279 activity_lens = ActivityLens(loading_trace)
280 dependencies_lens = request_dependencies_lens.RequestDependencyLens( 280 dependencies_lens = request_dependencies_lens.RequestDependencyLens(
281 loading_trace) 281 loading_trace)
282 deps = dependencies_lens.GetRequestDependencies() 282 deps = dependencies_lens.GetRequestDependencies()
283 for requests_dep in deps: 283 for requests_dep in deps:
284 print activity_lens.GenerateEdgeActivity(requests_dep) 284 print activity_lens.GenerateEdgeActivity(requests_dep)
OLDNEW
« no previous file with comments | « no previous file | tools/android/loading/prefetch_view.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698