| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // 0 is the implicit underflow bucket. | 62 // 0 is the implicit underflow bucket. |
| 63 // [|max|,infinity) is the implicit overflow bucket. | 63 // [|max|,infinity) is the implicit overflow bucket. |
| 64 // | 64 // |
| 65 // An enumaration histogram requires |max| + 1 number of | 65 // An enumaration histogram requires |max| + 1 number of |
| 66 // buckets. Note that the memory allocated in Chrome for each | 66 // buckets. Note that the memory allocated in Chrome for each |
| 67 // histogram is proportional to the number of buckets. Therefore, it | 67 // histogram is proportional to the number of buckets. Therefore, it |
| 68 // is strongly recommended to keep this number low (e.g., 50 is | 68 // is strongly recommended to keep this number low (e.g., 50 is |
| 69 // normal, while 100 is high). | 69 // normal, while 100 is high). |
| 70 bool SendEnumToUMA(const std::string& name, int sample, int max); | 70 bool SendEnumToUMA(const std::string& name, int sample, int max); |
| 71 | 71 |
| 72 // Sends a user action to Chrome for transport to UMA and returns true on |
| 73 // success. This method results in the equivalent of an asynchronous |
| 74 // non-blocking RPC to UserMetrics::RecordAction (see the comments in |
| 75 // chrome/browser/chromeos/external_metrics.cc and |
| 76 // chrome/browser/metrics/user_metrics.h on how to register new user actions). |
| 77 // |
| 78 // |action| is the user-generated event (e.g., "MuteKeyPressed"). |
| 79 bool SendUserActionToUMA(const std::string& action); |
| 80 |
| 72 // Sends to Autotest and returns true on success. | 81 // Sends to Autotest and returns true on success. |
| 73 static bool SendToAutotest(const std::string& name, int value); | 82 static bool SendToAutotest(const std::string& name, int value); |
| 74 | 83 |
| 75 private: | 84 private: |
| 76 friend class CMetricsLibraryTest; | 85 friend class CMetricsLibraryTest; |
| 77 friend class MetricsLibraryTest; | 86 friend class MetricsLibraryTest; |
| 78 FRIEND_TEST(MetricsLibraryTest, AreMetricsEnabled); | 87 FRIEND_TEST(MetricsLibraryTest, AreMetricsEnabled); |
| 79 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessage); | 88 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessage); |
| 80 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessageTooLong); | 89 FRIEND_TEST(MetricsLibraryTest, FormatChromeMessageTooLong); |
| 81 FRIEND_TEST(MetricsLibraryTest, IsDeviceMounted); | 90 FRIEND_TEST(MetricsLibraryTest, IsDeviceMounted); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 109 static time_t cached_enabled_time_; | 118 static time_t cached_enabled_time_; |
| 110 | 119 |
| 111 // Cached state of whether or not metrics were enabled. | 120 // Cached state of whether or not metrics were enabled. |
| 112 static bool cached_enabled_; | 121 static bool cached_enabled_; |
| 113 | 122 |
| 114 const char* uma_events_file_; | 123 const char* uma_events_file_; |
| 115 const char* consent_file_; | 124 const char* consent_file_; |
| 116 }; | 125 }; |
| 117 | 126 |
| 118 #endif // METRICS_LIBRARY_H_ | 127 #endif // METRICS_LIBRARY_H_ |
| OLD | NEW |