| OLD | NEW |
| 1 // Copyright (c) 2011 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/logging.h" | 8 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 9 | 10 |
| 10 namespace net { | 11 namespace net { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 15 const char* FileErrorSourceStrings[] = { |
| 16 "OPEN", |
| 17 "WRITE", |
| 18 "READ", |
| 19 "SEEK", |
| 20 "FLUSH", |
| 21 "SET_EOF", |
| 22 "GET_SIZE" |
| 23 }; |
| 24 |
| 25 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(FileErrorSourceStrings) == |
| 26 FILE_ERROR_SOURCE_COUNT, |
| 27 file_error_source_enum_has_changed); |
| 28 |
| 14 void RecordFileErrorTypeCount(FileErrorSource source) { | 29 void RecordFileErrorTypeCount(FileErrorSource source) { |
| 15 UMA_HISTOGRAM_ENUMERATION( | 30 UMA_HISTOGRAM_ENUMERATION( |
| 16 "Net.FileErrorType_Counts", source, FILE_ERROR_SOURCE_COUNT); | 31 "Net.FileErrorType_Counts", source, FILE_ERROR_SOURCE_COUNT); |
| 17 } | 32 } |
| 18 | 33 |
| 19 } // namespace | 34 } // namespace |
| 20 | 35 |
| 21 void RecordFileError(int error, FileErrorSource source, bool record) { | 36 void RecordFileError(int error, FileErrorSource source, bool record) { |
| 22 LOG(ERROR) << " " << __FUNCTION__ << "()" | 37 LOG(ERROR) << " " << __FUNCTION__ << "()" |
| 23 << " error = " << error | 38 << " error = " << error |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 UMA_HISTOGRAM_ENUMERATION("Net.FileError_GetSize", error, max_error); | 86 UMA_HISTOGRAM_ENUMERATION("Net.FileError_GetSize", error, max_error); |
| 72 UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_GetSize", bucket, | 87 UMA_HISTOGRAM_ENUMERATION("Net.FileErrorRange_GetSize", bucket, |
| 73 max_bucket); | 88 max_bucket); |
| 74 break; | 89 break; |
| 75 | 90 |
| 76 default: | 91 default: |
| 77 break; | 92 break; |
| 78 } | 93 } |
| 79 } | 94 } |
| 80 | 95 |
| 96 const char* GetFileErrorSourceName(FileErrorSource source) { |
| 97 DCHECK_NE(FILE_ERROR_SOURCE_COUNT, source); |
| 98 return FileErrorSourceStrings[source]; |
| 99 } |
| 100 |
| 81 } // namespace net | 101 } // namespace net |
| OLD | NEW |