| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.net; |
| 6 |
| 7 import android.support.annotation.Nullable; |
| 8 |
| 9 /** |
| 10 * Metrics collected for a single request. |
| 11 * |
| 12 * {@hide} as it's a prototype. |
| 13 */ |
| 14 public final class UrlRequestMetrics { |
| 15 @Nullable |
| 16 private final Long mTtfbMs; |
| 17 @Nullable |
| 18 private final Long mTotalTimeMs; |
| 19 @Nullable |
| 20 private final Long mSentBytesCount; |
| 21 @Nullable |
| 22 private final Long mReceivedBytesCount; |
| 23 |
| 24 public UrlRequestMetrics(@Nullable Long ttfbMs, @Nullable Long totalTimeMs, |
| 25 @Nullable Long sentBytesCount, @Nullable Long receivedBytesCount) { |
| 26 mTtfbMs = ttfbMs; |
| 27 mTotalTimeMs = totalTimeMs; |
| 28 mSentBytesCount = sentBytesCount; |
| 29 mReceivedBytesCount = receivedBytesCount; |
| 30 } |
| 31 |
| 32 /** |
| 33 * Returns milliseconds between request initiation and first byte of respons
e headers, |
| 34 * or null if not collected. |
| 35 */ |
| 36 @Nullable |
| 37 public Long getTtfbMs() { |
| 38 return mTtfbMs; |
| 39 } |
| 40 |
| 41 /** |
| 42 * Returns milliseconds between request initiation and finish, |
| 43 * including a failure or cancellation, or null if not collected. |
| 44 */ |
| 45 @Nullable |
| 46 public Long getTotalTimeMs() { |
| 47 return mTotalTimeMs; |
| 48 } |
| 49 |
| 50 /** |
| 51 * Returns total bytes sent over the network transport layer, or null if not
collected. |
| 52 */ |
| 53 @Nullable |
| 54 public Long getSentBytesCount() { |
| 55 return mSentBytesCount; |
| 56 } |
| 57 |
| 58 /** |
| 59 * Returns total bytes received over the network transport layer, or null if
not collected. |
| 60 */ |
| 61 @Nullable |
| 62 public Long getReceivedBytesCount() { |
| 63 return mReceivedBytesCount; |
| 64 } |
| 65 } |
| OLD | NEW |