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

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

Issue 1888343003: Clovis: contentful paint upgrades. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url-rename
Patch Set: Use new frame detection Created 4 years, 7 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 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 """Models the effect of prefetching resources from a loading trace. 5 """Models the effect of prefetching resources from a loading trace.
6 6
7 For example, this can be used to evaluate NoState Prefetch 7 For example, this can be used to evaluate NoState Prefetch
8 (https://goo.gl/B3nRUR). 8 (https://goo.gl/B3nRUR).
9 9
10 When executed as a script, takes a trace as a command-line arguments and shows 10 When executed as a script, takes a trace as a command-line arguments and shows
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 46
47 class PrefetchSimulationView(object): 47 class PrefetchSimulationView(object):
48 """Simulates the effect of prefetch.""" 48 """Simulates the effect of prefetch."""
49 def __init__(self, trace, dependencies_lens, user_lens): 49 def __init__(self, trace, dependencies_lens, user_lens):
50 self.postload_msec = None 50 self.postload_msec = None
51 self.graph = None 51 self.graph = None
52 if trace is None: 52 if trace is None:
53 return 53 return
54 requests = trace.request_track.GetEvents() 54 requests = trace.request_track.GetEvents()
55 critical_requests_ids = user_lens.CriticalRequests() 55 critical_requests_ids = user_lens.CriticalRequestIds()
56 self.postload_msec = user_lens.PostloadTimeMsec() 56 self.postload_msec = user_lens.PostloadTimeMsec()
57 self.graph = dependency_graph.RequestDependencyGraph( 57 self.graph = dependency_graph.RequestDependencyGraph(
58 requests, dependencies_lens, node_class=RequestNode) 58 requests, dependencies_lens, node_class=RequestNode)
59 preloaded_requests = [r.request_id for r in self.PreloadedRequests( 59 preloaded_requests = [r.request_id for r in self.PreloadedRequests(
60 requests[0], dependencies_lens, trace)] 60 requests[0], dependencies_lens, trace)]
61 self._AnnotateNodes(self.graph.graph.Nodes(), preloaded_requests, 61 self._AnnotateNodes(self.graph.graph.Nodes(), preloaded_requests,
62 critical_requests_ids) 62 critical_requests_ids)
63 63
64 def Cost(self): 64 def Cost(self):
65 """Returns the cost of the graph, restricted to the critical requests.""" 65 """Returns the cost of the graph, restricted to the critical requests."""
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 def main(filename): 182 def main(filename):
183 trace = loading_trace.LoadingTrace.FromJsonFile(filename) 183 trace = loading_trace.LoadingTrace.FromJsonFile(filename)
184 dependencies_lens = request_dependencies_lens.RequestDependencyLens(trace) 184 dependencies_lens = request_dependencies_lens.RequestDependencyLens(trace)
185 user_lens = user_satisfied_lens.FirstContentfulPaintLens(trace) 185 user_lens = user_satisfied_lens.FirstContentfulPaintLens(trace)
186 _PrintSumamry(trace, dependencies_lens, user_lens) 186 _PrintSumamry(trace, dependencies_lens, user_lens)
187 187
188 188
189 if __name__ == '__main__': 189 if __name__ == '__main__':
190 import sys 190 import sys
191 main(sys.argv[1]) 191 main(sys.argv[1])
OLDNEW
« no previous file with comments | « no previous file | tools/android/loading/request_track.py » ('j') | tools/android/loading/user_satisfied_lens.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698