| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // File error statistics gathering. | 5 // File error statistics gathering. |
| 6 | 6 |
| 7 #ifndef NET_BASE_FILE_STREAM_METRICS_H_ | 7 #ifndef NET_BASE_FILE_STREAM_METRICS_H_ |
| 8 #define NET_BASE_FILE_STREAM_METRICS_H_ | 8 #define NET_BASE_FILE_STREAM_METRICS_H_ |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 enum FileErrorSource { | 12 enum FileErrorSource { |
| 13 FILE_ERROR_SOURCE_OPEN = 0, | 13 FILE_ERROR_SOURCE_OPEN = 0, |
| 14 FILE_ERROR_SOURCE_WRITE, | 14 FILE_ERROR_SOURCE_WRITE, |
| 15 FILE_ERROR_SOURCE_READ, | 15 FILE_ERROR_SOURCE_READ, |
| 16 FILE_ERROR_SOURCE_SEEK, | 16 FILE_ERROR_SOURCE_SEEK, |
| 17 FILE_ERROR_SOURCE_FLUSH, | 17 FILE_ERROR_SOURCE_FLUSH, |
| 18 FILE_ERROR_SOURCE_SET_EOF, | 18 FILE_ERROR_SOURCE_SET_EOF, |
| 19 FILE_ERROR_SOURCE_GET_SIZE, | 19 FILE_ERROR_SOURCE_GET_SIZE, |
| 20 FILE_ERROR_SOURCE_CLOSE, |
| 20 FILE_ERROR_SOURCE_COUNT, | 21 FILE_ERROR_SOURCE_COUNT, |
| 21 }; | 22 }; |
| 22 | 23 |
| 23 // UMA error statistics gathering. | 24 // UMA error statistics gathering. |
| 24 // Put the error value into a bucket. | 25 // Put the error value into a bucket. |
| 25 int GetFileErrorUmaBucket(int error); | 26 int GetFileErrorUmaBucket(int error); |
| 26 | 27 |
| 27 // The largest bucket number, plus 1. | 28 // The largest bucket number, plus 1. |
| 28 int MaxFileErrorUmaBucket(); | 29 int MaxFileErrorUmaBucket(); |
| 29 | 30 |
| 30 // The highest error value we want to individually report. | 31 // The highest error value we want to individually report. |
| 31 int MaxFileErrorUmaValue(); | 32 int MaxFileErrorUmaValue(); |
| 32 | 33 |
| 33 // |error| is a platform-specific error (Windows or Posix). | 34 // |error| is a platform-specific error (Windows or Posix). |
| 34 // |source| indicates the operation that resulted in the error. | 35 // |source| indicates the operation that resulted in the error. |
| 35 // |record| is a flag indicating that we are interested in this error. | 36 // |record| is a flag indicating that we are interested in this error. |
| 36 void RecordFileError(int error, FileErrorSource source, bool record); | 37 void RecordFileError(int error, FileErrorSource source, bool record); |
| 37 | 38 |
| 38 // Gets a description for the source of a file error. | 39 // Gets a description for the source of a file error. |
| 39 const char* GetFileErrorSourceName(FileErrorSource source); | 40 const char* GetFileErrorSourceName(FileErrorSource source); |
| 40 | 41 |
| 41 } // namespace net | 42 } // namespace net |
| 42 | 43 |
| 43 #endif // NET_BASE_FILE_STREAM_METRICS_H_ | 44 #endif // NET_BASE_FILE_STREAM_METRICS_H_ |
| OLD | NEW |