Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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 #include "net/base/file_stream_metrics.h" | |
| 6 | |
| 7 #include <string> | |
| 8 #if defined(OS_WIN) | |
| 9 #include <windows.h> | |
|
cbentzel
2011/08/16 13:36:02
You shouldn't need to include windows.h here.
ahendrickson
2011/08/17 20:12:04
Done.
| |
| 10 #endif | |
| 11 | |
| 12 #include "base/logging.h" | |
| 13 #include "base/metrics/histogram.h" | |
| 14 #include "net/base/file_stream.h" | |
|
cbentzel
2011/08/16 13:36:02
You shouldn't need to include file_stream.h either
ahendrickson
2011/08/17 20:12:04
Done.
| |
| 15 | |
| 16 namespace net { | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 void RecordFileErrorTypeCount(FileErrorSource type) { | |
| 21 UMA_HISTOGRAM_ENUMERATION( | |
| 22 "FileErrorType.Counts", type, FILE_ERROR_SOURCE_COUNT); | |
| 23 } | |
| 24 | |
| 25 } // namespace | |
| 26 | |
| 27 void RecordFileError(int error, FileErrorSource type) { | |
| 28 RecordFileErrorTypeCount(type); | |
| 29 | |
| 30 DLOG(WARNING) << "() " << "Recording error " << error | |
|
cbentzel
2011/08/16 13:36:02
Remove this.
ahendrickson
2011/08/17 20:12:04
Done.
| |
| 31 << " of type " << type; | |
| 32 | |
| 33 unsigned int max_error = (1U << 14) - 2; // Histogram limit. | |
| 34 | |
| 35 error = ReduceErrorRange(error); | |
| 36 max_error = MaxError(); | |
|
cbentzel
2011/08/16 13:36:02
You might want to document that this can never cha
ahendrickson
2011/08/17 20:12:04
Done.
| |
| 37 | |
| 38 switch(type) { | |
| 39 case FILE_ERROR_SOURCE_IS_NOT_OPEN: | |
| 40 { | |
|
cbentzel
2011/08/16 13:36:02
Nit: Do you need these braces? May be less vertica
ahendrickson
2011/08/17 20:12:04
Done.
| |
| 41 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.NotOpen", error, max_error); | |
| 42 break; | |
| 43 } | |
| 44 case FILE_ERROR_SOURCE_OPEN: | |
| 45 { | |
| 46 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.Open", error, max_error); | |
| 47 break; | |
| 48 } | |
| 49 case FILE_ERROR_SOURCE_WRITE: | |
| 50 { | |
| 51 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.Write", error, max_error); | |
| 52 break; | |
| 53 } | |
| 54 case FILE_ERROR_SOURCE_READ: | |
| 55 { | |
| 56 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.Read", error, max_error); | |
| 57 break; | |
| 58 } | |
| 59 case FILE_ERROR_SOURCE_SEEK: | |
| 60 { | |
| 61 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.Seek", error, max_error); | |
| 62 break; | |
| 63 } | |
| 64 case FILE_ERROR_SOURCE_FLUSH: | |
| 65 { | |
| 66 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.Flush", error, max_error); | |
| 67 break; | |
| 68 } | |
| 69 case FILE_ERROR_SOURCE_SET_EOF: | |
| 70 { | |
| 71 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.SetEof", error, max_error); | |
| 72 break; | |
| 73 } | |
| 74 case FILE_ERROR_SOURCE_GET_SIZE: | |
| 75 { | |
| 76 UMA_HISTOGRAM_ENUMERATION("FileErrorSource.GetSize", error, max_error); | |
| 77 break; | |
| 78 } | |
| 79 default: | |
| 80 break; | |
| 81 } | |
| 82 } | |
| 83 | |
| 84 } // namespace net | |
| OLD | NEW |