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

Side by Side Diff: tools/chrome_proxy/common/network_metrics.py

Issue 2539973004: Update reference to page_test module to use legacy_page_test module (Closed)
Patch Set: update Created 4 years 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 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 os 10 import os
11 import sys 11 import sys
12 import zlib 12 import zlib
13 13
14 from common import inspector_network 14 from common import inspector_network
15 from telemetry.timeline import model 15 from telemetry.timeline import model
16 16
17 sys.path.append( 17 sys.path.append(
18 os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'perf')) 18 os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'perf'))
19 from metrics import Metric 19 from metrics import Metric
20 20
21 from telemetry.page import page_test 21 from telemetry.page import legacy_page_test
22 # All network metrics are Chrome only for now. 22 # All network metrics are Chrome only for now.
23 from telemetry.value import scalar 23 from telemetry.value import scalar
24 24
25 25
26 class NetworkMetricException(page_test.MeasurementFailure): 26 class NetworkMetricException(page_test.MeasurementFailure):
27 pass 27 pass
28 28
29 29
30 class HTTPResponse(object): 30 class HTTPResponse(object):
31 """ Represents an HTTP response from a timeline event.""" 31 """ Represents an HTTP response from a timeline event."""
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if self.compute_data_saving: 210 if self.compute_data_saving:
211 if (original_content_length > 0 and 211 if (original_content_length > 0 and
212 original_content_length >= content_length): 212 original_content_length >= content_length):
213 saving = (float(original_content_length-content_length) * 100 / 213 saving = (float(original_content_length-content_length) * 100 /
214 original_content_length) 214 original_content_length)
215 results.AddValue(scalar.ScalarValue( 215 results.AddValue(scalar.ScalarValue(
216 results.current_page, 'data_saving', 'percent', saving)) 216 results.current_page, 'data_saving', 'percent', saving))
217 else: 217 else:
218 results.AddValue(scalar.ScalarValue( 218 results.AddValue(scalar.ScalarValue(
219 results.current_page, 'data_saving', 'percent', 0.0)) 219 results.current_page, 'data_saving', 'percent', 0.0))
OLDNEW
« no previous file with comments | « tools/chrome_proxy/common/chrome_proxy_metrics.py ('k') | tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698