Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: net/base/file_stream_metrics.cc

Issue 7583049: Record UMA statistics for file_stream operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Posix error. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "base/logging.h"
8 #include "base/metrics/histogram.h"
9
10 namespace net {
11
12 namespace {
13
14 void RecordFileErrorTypeCount(FileErrorSource source) {
15 UMA_HISTOGRAM_ENUMERATION(
16 "FileErrorType.Counts", source, FILE_ERROR_SOURCE_COUNT);
17 }
18
19 } // namespace
20
21 void RecordFileError(int error, FileErrorSource source, bool record) {
22 if (!record)
23 return;
24
25 RecordFileErrorTypeCount(source);
26
27 int bucket = GetErrorBucket(error);
cbentzel 2011/08/23 01:52:02 Rather than write logic to figure out which bucket
cbentzel 2011/08/30 14:48:23 As we discussed, I'm OK with the approach you took
28
29 static const int max_bucket = MaxBucket(); // Fixed value per platform.
30 static const int max_error = MaxError(); // Fixed value per platform.
31
32 switch(source) {
33 case FILE_ERROR_SOURCE_OPEN:
34 UMA_HISTOGRAM_ENUMERATION("FileError.Open", error, max_error);
cbentzel 2011/08/23 01:52:02 This should be Net.FileOpen_Error Net.FileOpen_E
ahendrickson 2011/08/31 19:39:52 Done.
35 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.Open", bucket, max_bucket);
36 break;
37
cbentzel 2011/08/23 01:52:02 Nit: most code I've seen doesn't have newlines bet
38 case FILE_ERROR_SOURCE_WRITE:
39 UMA_HISTOGRAM_ENUMERATION("FileError.Write", error, max_error);
40 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.Write", bucket, max_bucket);
41 break;
42
43 case FILE_ERROR_SOURCE_READ:
44 UMA_HISTOGRAM_ENUMERATION("FileError.Read", error, max_error);
45 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.Read", bucket, max_bucket);
46 break;
47
48 case FILE_ERROR_SOURCE_SEEK:
49 UMA_HISTOGRAM_ENUMERATION("FileError.Seek", error, max_error);
50 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.Seek", bucket, max_bucket);
51 break;
52
53 case FILE_ERROR_SOURCE_FLUSH:
54 UMA_HISTOGRAM_ENUMERATION("FileError.Flush", error, max_error);
55 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.Flush", bucket, max_bucket);
56 break;
57
58 case FILE_ERROR_SOURCE_SET_EOF:
59 UMA_HISTOGRAM_ENUMERATION("FileError.SetEof", error, max_error);
60 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.SetEof", bucket, max_bucket);
61 break;
62
63 case FILE_ERROR_SOURCE_GET_SIZE:
64 UMA_HISTOGRAM_ENUMERATION("FileError.GetSize", error, max_error);
65 UMA_HISTOGRAM_ENUMERATION("FileErrorRange.GetSize", bucket, max_bucket);
66 break;
67
68 default:
69 break;
70 }
71 }
72
73 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698