OLD | NEW |
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 network activity between timestamps.""" | 5 """Gives a picture of the network activity between timestamps.""" |
6 | 6 |
7 import bisect | 7 import bisect |
8 import collections | 8 import collections |
9 import itertools | 9 import itertools |
10 import operator | 10 import operator |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 return self._request.data_chunks[self._chunk_index][1] | 230 return self._request.data_chunks[self._chunk_index][1] |
231 | 231 |
232 def UploadRate(self): | 232 def UploadRate(self): |
233 """Returns the upload rate of this event in Bytes / s.""" | 233 """Returns the upload rate of this event in Bytes / s.""" |
234 return 1000 * self.UploadedBytes() / float(self.end_msec - self.start_msec) | 234 return 1000 * self.UploadedBytes() / float(self.end_msec - self.start_msec) |
235 | 235 |
236 def DownloadRate(self): | 236 def DownloadRate(self): |
237 """Returns the download rate of this event in Bytes / s.""" | 237 """Returns the download rate of this event in Bytes / s.""" |
238 downloaded_bytes = self.DownloadedBytes() | 238 downloaded_bytes = self.DownloadedBytes() |
239 value = 1000 * downloaded_bytes / float(self.end_msec - self.start_msec) | 239 value = 1000 * downloaded_bytes / float(self.end_msec - self.start_msec) |
240 if value > 1e6: | |
241 print self._kind, downloaded_bytes, self.end_msec - self.start_msec | |
242 return value | 240 return value |
OLD | NEW |