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

Side by Side Diff: tools/perf/metrics/network.py

Issue 332213003: Move telemetry/core/timeline and timeline_data to telemetry/timeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | « tools/perf/measurements/timeline_controller.py ('k') | tools/perf/metrics/network_unittest.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 base64 5 import base64
6 import gzip 6 import gzip
7 import hashlib 7 import hashlib
8 import io 8 import io
9 import logging 9 import logging
10 import zlib 10 import zlib
11 11
12 from metrics import Metric 12 from metrics import Metric
13 from telemetry.page import page_measurement 13 from telemetry.page import page_measurement
14 # All network metrics are Chrome only for now. 14 # All network metrics are Chrome only for now.
15 from telemetry.core.backends.chrome import inspector_network 15 from telemetry.core.backends.chrome import inspector_network
16 from telemetry.core.timeline import recording_options 16 from telemetry.timeline import recording_options
17 17
18 18
19 class NetworkMetricException(page_measurement.MeasurementFailure): 19 class NetworkMetricException(page_measurement.MeasurementFailure):
20 pass 20 pass
21 21
22 22
23 class HTTPResponse(object): 23 class HTTPResponse(object):
24 """ Represents an HTTP response from a timeline event.""" 24 """ Represents an HTTP response from a timeline event."""
25 def __init__(self, event): 25 def __init__(self, event):
26 self._response = ( 26 self._response = (
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 results.Add('content_length', 'bytes', content_length) 182 results.Add('content_length', 'bytes', content_length)
183 results.Add('original_content_length', 'bytes', original_content_length) 183 results.Add('original_content_length', 'bytes', original_content_length)
184 if self.compute_data_saving: 184 if self.compute_data_saving:
185 if (original_content_length > 0 and 185 if (original_content_length > 0 and
186 original_content_length >= content_length): 186 original_content_length >= content_length):
187 saving = (float(original_content_length-content_length) * 100 / 187 saving = (float(original_content_length-content_length) * 100 /
188 original_content_length) 188 original_content_length)
189 results.Add('data_saving', 'percent', saving) 189 results.Add('data_saving', 'percent', saving)
190 else: 190 else:
191 results.Add('data_saving', 'percent', 0.0) 191 results.Add('data_saving', 'percent', 0.0)
OLDNEW
« no previous file with comments | « tools/perf/measurements/timeline_controller.py ('k') | tools/perf/metrics/network_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698