OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef METRICS_LIBRARY_H_ | 5 #ifndef METRICS_LIBRARY_H_ |
6 #define METRICS_LIBRARY_H_ | 6 #define METRICS_LIBRARY_H_ |
7 | 7 |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // | 65 // |
66 // An enumaration histogram requires |max| + 1 number of | 66 // An enumaration histogram requires |max| + 1 number of |
67 // buckets. Note that the memory allocated in Chrome for each | 67 // buckets. Note that the memory allocated in Chrome for each |
68 // histogram is proportional to the number of buckets. Therefore, it | 68 // histogram is proportional to the number of buckets. Therefore, it |
69 // is strongly recommended to keep this number low (e.g., 50 is | 69 // is strongly recommended to keep this number low (e.g., 50 is |
70 // normal, while 100 is high). | 70 // normal, while 100 is high). |
71 bool SendEnumToUMA(const std::string& name, int sample, int max); | 71 bool SendEnumToUMA(const std::string& name, int sample, int max); |
72 | 72 |
73 // Sends a user action to Chrome for transport to UMA and returns true on | 73 // Sends a user action to Chrome for transport to UMA and returns true on |
74 // success. This method results in the equivalent of an asynchronous | 74 // success. This method results in the equivalent of an asynchronous |
75 // non-blocking RPC to UserMetrics::RecordAction (see the comments in | 75 // non-blocking RPC to UserMetrics::RecordAction. The new metric must be |
76 // chrome/browser/chromeos/external_metrics.cc and | 76 // added to chrome/tools/extract_actions.py in the Chromium repository, which |
77 // chrome/browser/metrics/user_metrics.h on how to register new user actions). | 77 // should then be run to generate a hash for the new action. |
| 78 // |
| 79 // Until http://crosbug.com/11125 is fixed, the metric must also be added to |
| 80 // chrome/browser/chromeos/external_metrics.cc. |
78 // | 81 // |
79 // |action| is the user-generated event (e.g., "MuteKeyPressed"). | 82 // |action| is the user-generated event (e.g., "MuteKeyPressed"). |
80 bool SendUserActionToUMA(const std::string& action); | 83 bool SendUserActionToUMA(const std::string& action); |
81 | 84 |
82 // Sends to Autotest and returns true on success. | 85 // Sends to Autotest and returns true on success. |
83 static bool SendToAutotest(const std::string& name, int value); | 86 static bool SendToAutotest(const std::string& name, int value); |
84 | 87 |
85 private: | 88 private: |
86 friend class CMetricsLibraryTest; | 89 friend class CMetricsLibraryTest; |
87 friend class MetricsLibraryTest; | 90 friend class MetricsLibraryTest; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 static time_t cached_enabled_time_; | 122 static time_t cached_enabled_time_; |
120 | 123 |
121 // Cached state of whether or not metrics were enabled. | 124 // Cached state of whether or not metrics were enabled. |
122 static bool cached_enabled_; | 125 static bool cached_enabled_; |
123 | 126 |
124 const char* uma_events_file_; | 127 const char* uma_events_file_; |
125 const char* consent_file_; | 128 const char* consent_file_; |
126 }; | 129 }; |
127 | 130 |
128 #endif // METRICS_LIBRARY_H_ | 131 #endif // METRICS_LIBRARY_H_ |
OLD | NEW |