| 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 #include "net/base/file_stream_metrics.h" | 5 #include "net/base/file_stream_metrics.h" | 
| 6 | 6 | 
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" | 
| 8 #include "base/logging.h" | 8 #include "base/logging.h" | 
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" | 
| 10 | 10 | 
| 11 namespace net { | 11 namespace net { | 
| 12 | 12 | 
| 13 namespace { | 13 namespace { | 
| 14 | 14 | 
| 15 const char* FileErrorSourceStrings[] = { | 15 const char* FileErrorSourceStrings[] = { | 
| 16   "OPEN", | 16   "OPEN", | 
| 17   "WRITE", | 17   "WRITE", | 
| 18   "READ", | 18   "READ", | 
| 19   "SEEK", | 19   "SEEK", | 
| 20   "FLUSH", | 20   "FLUSH", | 
| 21   "SET_EOF", | 21   "SET_EOF", | 
| 22   "GET_SIZE" | 22   "GET_SIZE", | 
|  | 23   "CLOSE" | 
| 23 }; | 24 }; | 
| 24 | 25 | 
| 25 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(FileErrorSourceStrings) == | 26 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(FileErrorSourceStrings) == | 
| 26                    FILE_ERROR_SOURCE_COUNT, | 27                    FILE_ERROR_SOURCE_COUNT, | 
| 27                file_error_source_enum_has_changed); | 28                file_error_source_enum_has_changed); | 
| 28 | 29 | 
| 29 void RecordFileErrorTypeCount(FileErrorSource source) { | 30 void RecordFileErrorTypeCount(FileErrorSource source) { | 
| 30   UMA_HISTOGRAM_ENUMERATION( | 31   UMA_HISTOGRAM_ENUMERATION( | 
| 31       "Net.FileErrorType_Counts", source, FILE_ERROR_SOURCE_COUNT); | 32       "Net.FileErrorType_Counts", source, FILE_ERROR_SOURCE_COUNT); | 
| 32 } | 33 } | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 81       UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_SetEof", bucket, | 82       UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_SetEof", bucket, | 
| 82                                 max_bucket); | 83                                 max_bucket); | 
| 83       break; | 84       break; | 
| 84 | 85 | 
| 85     case FILE_ERROR_SOURCE_GET_SIZE: | 86     case FILE_ERROR_SOURCE_GET_SIZE: | 
| 86       UMA_HISTOGRAM_ENUMERATION("Net.FileError_GetSize", error, max_error); | 87       UMA_HISTOGRAM_ENUMERATION("Net.FileError_GetSize", error, max_error); | 
| 87       UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_GetSize", bucket, | 88       UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_GetSize", bucket, | 
| 88                                 max_bucket); | 89                                 max_bucket); | 
| 89       break; | 90       break; | 
| 90 | 91 | 
|  | 92     case FILE_ERROR_SOURCE_CLOSE: | 
|  | 93       UMA_HISTOGRAM_ENUMERATION("Net.FileError_Close", error, max_error); | 
|  | 94       UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_Close", bucket, | 
|  | 95                                 max_bucket); | 
|  | 96       break; | 
|  | 97 | 
| 91     default: | 98     default: | 
| 92       break; | 99       break; | 
| 93   } | 100   } | 
| 94 } | 101 } | 
| 95 | 102 | 
| 96 const char* GetFileErrorSourceName(FileErrorSource source) { | 103 const char* GetFileErrorSourceName(FileErrorSource source) { | 
| 97   DCHECK_NE(FILE_ERROR_SOURCE_COUNT, source); | 104   DCHECK_NE(FILE_ERROR_SOURCE_COUNT, source); | 
| 98   return FileErrorSourceStrings[source]; | 105   return FileErrorSourceStrings[source]; | 
| 99 } | 106 } | 
| 100 | 107 | 
| 101 }  // namespace net | 108 }  // namespace net | 
| OLD | NEW | 
|---|