Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Wade Guthrie | 60a3706 | 2013-04-02 11:39:09 -0700 | [diff] [blame] | 5 | #ifndef SHILL_METRICS_H_ |
| 6 | #define SHILL_METRICS_H_ |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 7 | |
| 8 | #include <list> |
| 9 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 10 | #include <base/memory/scoped_vector.h> |
| 11 | #include <metrics/metrics_library.h> |
| 12 | #include <metrics/timer.h> |
| 13 | |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 14 | #include "shill/event_dispatcher.h" |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 15 | #include "shill/ieee80211.h" |
Thieu Le | 85e050b | 2012-03-13 15:04:38 -0700 | [diff] [blame] | 16 | #include "shill/portal_detector.h" |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 17 | #include "shill/power_manager.h" |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 18 | #include "shill/refptr_types.h" |
| 19 | #include "shill/service.h" |
| 20 | |
| 21 | namespace shill { |
| 22 | |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 23 | class WiFiMainTest; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 24 | class WiFiService; |
| 25 | |
| 26 | class Metrics { |
| 27 | public: |
| 28 | enum WiFiChannel { |
| 29 | kWiFiChannelUndef = 0, |
| 30 | kWiFiChannel2412 = 1, |
| 31 | kWiFiChannel2417 = 2, |
| 32 | kWiFiChannel2422 = 3, |
| 33 | kWiFiChannel2427 = 4, |
| 34 | kWiFiChannel2432 = 5, |
| 35 | kWiFiChannel2437 = 6, |
| 36 | kWiFiChannel2442 = 7, |
| 37 | kWiFiChannel2447 = 8, |
| 38 | kWiFiChannel2452 = 9, |
| 39 | kWiFiChannel2457 = 10, |
| 40 | kWiFiChannel2462 = 11, |
| 41 | kWiFiChannel2467 = 12, |
| 42 | kWiFiChannel2472 = 13, |
| 43 | kWiFiChannel2484 = 14, |
| 44 | |
| 45 | kWiFiChannel5180 = 15, |
| 46 | kWiFiChannel5200 = 16, |
| 47 | kWiFiChannel5220 = 17, |
| 48 | kWiFiChannel5240 = 18, |
| 49 | kWiFiChannel5260 = 19, |
| 50 | kWiFiChannel5280 = 20, |
| 51 | kWiFiChannel5300 = 21, |
| 52 | kWiFiChannel5320 = 22, |
| 53 | |
| 54 | kWiFiChannel5500 = 23, |
| 55 | kWiFiChannel5520 = 24, |
| 56 | kWiFiChannel5540 = 25, |
| 57 | kWiFiChannel5560 = 26, |
| 58 | kWiFiChannel5580 = 27, |
| 59 | kWiFiChannel5600 = 28, |
| 60 | kWiFiChannel5620 = 29, |
| 61 | kWiFiChannel5640 = 30, |
| 62 | kWiFiChannel5660 = 31, |
| 63 | kWiFiChannel5680 = 32, |
| 64 | kWiFiChannel5700 = 33, |
| 65 | |
| 66 | kWiFiChannel5745 = 34, |
| 67 | kWiFiChannel5765 = 35, |
| 68 | kWiFiChannel5785 = 36, |
| 69 | kWiFiChannel5805 = 37, |
| 70 | kWiFiChannel5825 = 38, |
| 71 | |
| 72 | kWiFiChannel5170 = 39, |
| 73 | kWiFiChannel5190 = 40, |
| 74 | kWiFiChannel5210 = 41, |
| 75 | kWiFiChannel5230 = 42, |
| 76 | |
| 77 | /* NB: ignore old 11b bands 2312..2372 and 2512..2532 */ |
| 78 | /* NB: ignore regulated bands 4920..4980 and 5020..5160 */ |
| 79 | kWiFiChannelMax |
| 80 | }; |
| 81 | |
Thieu Le | ad1ec2c | 2012-01-05 23:39:48 +0000 | [diff] [blame] | 82 | enum WiFiNetworkPhyMode { |
| 83 | kWiFiNetworkPhyModeUndef = 0, // Unknown/undefined |
| 84 | kWiFiNetworkPhyMode11a = 1, // 802.11a |
| 85 | kWiFiNetworkPhyMode11b = 2, // 802.11b |
| 86 | kWiFiNetworkPhyMode11g = 3, // 802.11g |
| 87 | kWiFiNetworkPhyMode11n = 4, // 802.11n |
| 88 | kWiFiNetworkPhyModeHalf = 5, // PSB Half-width |
| 89 | kWiFiNetworkPhyModeQuarter = 6, // PSB Quarter-width |
| 90 | kWiFiNetworkPhyModeTurbo = 7, // Atheros Turbo mode |
| 91 | |
| 92 | kWiFiNetworkPhyModeMax |
| 93 | }; |
| 94 | |
Paul Stewart | 21f4096 | 2013-03-01 14:27:28 -0800 | [diff] [blame] | 95 | enum EapOuterProtocol { |
| 96 | kEapOuterProtocolUnknown = 0, |
| 97 | kEapOuterProtocolLeap = 1, |
| 98 | kEapOuterProtocolPeap = 2, |
| 99 | kEapOuterProtocolTls = 3, |
| 100 | kEapOuterProtocolTtls = 4, |
| 101 | |
| 102 | kEapOuterProtocolMax |
| 103 | }; |
| 104 | |
| 105 | enum EapInnerProtocol { |
| 106 | kEapInnerProtocolUnknown = 0, |
| 107 | kEapInnerProtocolNone = 1, |
| 108 | kEapInnerProtocolPeapMd5 = 2, |
| 109 | kEapInnerProtocolPeapMschapv2 = 3, |
| 110 | kEapInnerProtocolTtlsEapMd5 = 4, |
| 111 | kEapInnerProtocolTtlsEapMschapv2 = 5, |
| 112 | kEapInnerProtocolTtlsMschapv2 = 6, |
| 113 | kEapInnerProtocolTtlsMschap = 7, |
| 114 | kEapInnerProtocolTtlsPap = 8, |
| 115 | kEapInnerProtocolTtlsChap = 9, |
| 116 | |
| 117 | kEapInnerProtocolMax |
| 118 | }; |
| 119 | |
Thieu Le | ad1ec2c | 2012-01-05 23:39:48 +0000 | [diff] [blame] | 120 | enum WiFiSecurity { |
| 121 | kWiFiSecurityUnknown = 0, |
| 122 | kWiFiSecurityNone = 1, |
| 123 | kWiFiSecurityWep = 2, |
| 124 | kWiFiSecurityWpa = 3, |
| 125 | kWiFiSecurityRsn = 4, |
| 126 | kWiFiSecurity8021x = 5, |
| 127 | kWiFiSecurityPsk = 6, |
| 128 | |
| 129 | kWiFiSecurityMax |
| 130 | }; |
| 131 | |
Thieu Le | 85e050b | 2012-03-13 15:04:38 -0700 | [diff] [blame] | 132 | enum PortalResult { |
| 133 | kPortalResultSuccess = 0, |
| 134 | kPortalResultDNSFailure = 1, |
| 135 | kPortalResultDNSTimeout = 2, |
| 136 | kPortalResultConnectionFailure = 3, |
| 137 | kPortalResultConnectionTimeout = 4, |
| 138 | kPortalResultHTTPFailure = 5, |
| 139 | kPortalResultHTTPTimeout = 6, |
| 140 | kPortalResultContentFailure = 7, |
| 141 | kPortalResultContentTimeout = 8, |
| 142 | kPortalResultUnknown = 9, |
| 143 | |
| 144 | kPortalResultMax |
| 145 | }; |
| 146 | |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 147 | enum LinkMonitorFailure { |
| 148 | kLinkMonitorMacAddressNotFound = 0, |
| 149 | kLinkMonitorClientStartFailure = 1, |
| 150 | kLinkMonitorTransmitFailure = 2, |
| 151 | kLinkMonitorFailureThresholdReached = 3, |
| 152 | |
| 153 | kLinkMonitorFailureMax |
| 154 | }; |
| 155 | |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 156 | enum WiFiStatusType { |
| 157 | kStatusCodeTypeByAp, |
| 158 | kStatusCodeTypeByClient, |
| 159 | kStatusCodeTypeByUser, |
| 160 | kStatusCodeTypeConsideredDead, |
| 161 | kStatusCodeTypeMax |
| 162 | }; |
| 163 | |
| 164 | enum WiFiDisconnectByWhom { |
| 165 | kDisconnectedByAp, |
| 166 | kDisconnectedNotByAp |
| 167 | }; |
| 168 | |
Paul Stewart | 85aea15 | 2013-01-22 09:31:56 -0800 | [diff] [blame] | 169 | enum ServiceFixupProfileType { |
| 170 | kMetricServiceFixupDefaultProfile, |
| 171 | kMetricServiceFixupUserProfile, |
| 172 | kMetricServiceFixupMax |
| 173 | }; |
| 174 | |
Arman Uguray | 6d528f1 | 2012-09-13 13:44:55 -0700 | [diff] [blame] | 175 | enum TerminationActionResult { |
Arman Uguray | ab22c16 | 2012-10-08 19:08:38 -0700 | [diff] [blame] | 176 | kTerminationActionResultSuccess, |
| 177 | kTerminationActionResultFailure, |
Arman Uguray | 6d528f1 | 2012-09-13 13:44:55 -0700 | [diff] [blame] | 178 | kTerminationActionResultMax |
| 179 | }; |
| 180 | |
Arman Uguray | ab22c16 | 2012-10-08 19:08:38 -0700 | [diff] [blame] | 181 | enum TerminationActionReason { |
| 182 | kTerminationActionReasonSuspend, |
| 183 | kTerminationActionReasonTerminate |
| 184 | }; |
| 185 | |
Thieu Le | 26fc01b | 2013-01-28 12:08:48 -0800 | [diff] [blame] | 186 | enum CellularDropTechnology { |
| 187 | kCellularDropTechnology1Xrtt = 0, |
| 188 | kCellularDropTechnologyEdge = 1, |
| 189 | kCellularDropTechnologyEvdo = 2, |
| 190 | kCellularDropTechnologyGprs = 3, |
| 191 | kCellularDropTechnologyGsm = 4, |
| 192 | kCellularDropTechnologyHspa = 5, |
| 193 | kCellularDropTechnologyHspaPlus = 6, |
| 194 | kCellularDropTechnologyLte = 7, |
| 195 | kCellularDropTechnologyUmts = 8, |
| 196 | kCellularDropTechnologyUnknown = 9, |
| 197 | kCellularDropTechnologyMax |
| 198 | }; |
| 199 | |
Thieu Le | 91fccf6 | 2013-04-22 15:23:16 -0700 | [diff] [blame] | 200 | enum CellularOutOfCreditsReason { |
| 201 | kCellularOutOfCreditsReasonConnectDisconnectLoop = 0, |
| 202 | kCellularOutOfCreditsReasonTxCongested = 1, |
| 203 | kCellularOutOfCreditsReasonElongatedTimeWait = 2, |
| 204 | kCellularOutOfCreditsReasonMax |
| 205 | }; |
| 206 | |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame] | 207 | enum CorruptedProfile { |
| 208 | kCorruptedProfile = 1, |
| 209 | kCorruptedProfileMax |
| 210 | }; |
| 211 | |
Paul Stewart | 91a43cb | 2013-03-02 21:34:15 -0800 | [diff] [blame] | 212 | enum VpnDriver { |
| 213 | kVpnDriverOpenVpn = 0, |
| 214 | kVpnDriverL2tpIpsec = 1, |
| 215 | kVpnDriverMax |
| 216 | }; |
| 217 | |
| 218 | enum VpnRemoteAuthenticationType { |
| 219 | kVpnRemoteAuthenticationTypeOpenVpnDefault = 0, |
| 220 | kVpnRemoteAuthenticationTypeOpenVpnCertificate = 1, |
| 221 | kVpnRemoteAuthenticationTypeL2tpIpsecDefault = 2, |
| 222 | kVpnRemoteAuthenticationTypeL2tpIpsecCertificate = 3, |
| 223 | kVpnRemoteAuthenticationTypeL2tpIpsecPsk = 4, |
| 224 | kVpnRemoteAuthenticationTypeMax |
| 225 | }; |
| 226 | |
| 227 | enum VpnUserAuthenticationType { |
| 228 | kVpnUserAuthenticationTypeOpenVpnNone = 0, |
| 229 | kVpnUserAuthenticationTypeOpenVpnCertificate = 1, |
| 230 | kVpnUserAuthenticationTypeOpenVpnUsernamePassword = 2, |
| 231 | kVpnUserAuthenticationTypeOpenVpnUsernamePasswordOtp = 3, |
| 232 | kVpnUserAuthenticationTypeL2tpIpsecNone = 4, |
| 233 | kVpnUserAuthenticationTypeL2tpIpsecCertificate = 5, |
| 234 | kVpnUserAuthenticationTypeL2tpIpsecUsernamePassword = 6, |
| 235 | kVpnUserAuthenticationTypeMax |
| 236 | }; |
| 237 | |
Thieu Le | 67370f6 | 2012-02-14 23:01:42 +0000 | [diff] [blame] | 238 | static const char kMetricDisconnect[]; |
| 239 | static const int kMetricDisconnectMax; |
| 240 | static const int kMetricDisconnectMin; |
| 241 | static const int kMetricDisconnectNumBuckets; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 242 | static const char kMetricNetworkChannel[]; |
| 243 | static const int kMetricNetworkChannelMax; |
Paul Stewart | 21f4096 | 2013-03-01 14:27:28 -0800 | [diff] [blame] | 244 | static const char kMetricNetworkEapInnerProtocol[]; |
| 245 | static const int kMetricNetworkEapInnerProtocolMax; |
| 246 | static const char kMetricNetworkEapOuterProtocol[]; |
| 247 | static const int kMetricNetworkEapOuterProtocolMax; |
Thieu Le | ad1ec2c | 2012-01-05 23:39:48 +0000 | [diff] [blame] | 248 | static const char kMetricNetworkPhyMode[]; |
| 249 | static const int kMetricNetworkPhyModeMax; |
| 250 | static const char kMetricNetworkSecurity[]; |
| 251 | static const int kMetricNetworkSecurityMax; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 252 | static const char kMetricNetworkServiceErrors[]; |
| 253 | static const int kMetricNetworkServiceErrorsMax; |
Paul Stewart | 23b393a | 2012-09-25 21:21:06 -0700 | [diff] [blame] | 254 | static const char kMetricNetworkSignalStrength[]; |
| 255 | static const int kMetricNetworkSignalStrengthMin; |
| 256 | static const int kMetricNetworkSignalStrengthMax; |
| 257 | static const int kMetricNetworkSignalStrengthNumBuckets; |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 258 | static const char kMetricTimeOnlineSeconds[]; |
| 259 | static const int kMetricTimeOnlineSecondsMax; |
| 260 | static const int kMetricTimeOnlineSecondsMin; |
| 261 | static const int kMetricTimeOnlineSecondsNumBuckets; |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 262 | static const char kMetricTimeResumeToReadyMilliseconds[]; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 263 | static const char kMetricTimeToConfigMilliseconds[]; |
Thieu Le | cdb5a21 | 2013-01-25 11:17:18 -0800 | [diff] [blame] | 264 | static const char kMetricTimeToConnectMilliseconds[]; |
| 265 | static const int kMetricTimeToConnectMillisecondsMax; |
| 266 | static const int kMetricTimeToConnectMillisecondsMin; |
| 267 | static const int kMetricTimeToConnectMillisecondsNumBuckets; |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 268 | static const char kMetricTimeToDropSeconds[]; |
| 269 | static const int kMetricTimeToDropSecondsMax; |
| 270 | static const int kMetricTimeToDropSecondsMin; |
Thieu Le | a2519bf | 2013-01-23 16:51:54 -0800 | [diff] [blame] | 271 | static const char kMetricTimeToDisableMilliseconds[]; |
| 272 | static const int kMetricTimeToDisableMillisecondsMax; |
| 273 | static const int kMetricTimeToDisableMillisecondsMin; |
| 274 | static const int kMetricTimeToDisableMillisecondsNumBuckets; |
Thieu Le | ce4483e | 2013-01-23 15:12:03 -0800 | [diff] [blame] | 275 | static const char kMetricTimeToEnableMilliseconds[]; |
| 276 | static const int kMetricTimeToEnableMillisecondsMax; |
| 277 | static const int kMetricTimeToEnableMillisecondsMin; |
| 278 | static const int kMetricTimeToEnableMillisecondsNumBuckets; |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 279 | static const char kMetricTimeToInitializeMilliseconds[]; |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 280 | static const int kMetricTimeToInitializeMillisecondsMax; |
Thieu Le | ce4483e | 2013-01-23 15:12:03 -0800 | [diff] [blame] | 281 | static const int kMetricTimeToInitializeMillisecondsMin; |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 282 | static const int kMetricTimeToInitializeMillisecondsNumBuckets; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 283 | static const char kMetricTimeToJoinMilliseconds[]; |
| 284 | static const char kMetricTimeToOnlineMilliseconds[]; |
| 285 | static const char kMetricTimeToPortalMilliseconds[]; |
Thieu Le | 18c1107 | 2013-01-28 17:21:37 -0800 | [diff] [blame] | 286 | static const char kMetricTimeToScanMilliseconds[]; |
| 287 | static const int kMetricTimeToScanMillisecondsMax; |
| 288 | static const int kMetricTimeToScanMillisecondsMin; |
| 289 | static const int kMetricTimeToScanMillisecondsNumBuckets; |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 290 | static const int kTimerHistogramMillisecondsMax; |
| 291 | static const int kTimerHistogramMillisecondsMin; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 292 | static const int kTimerHistogramNumBuckets; |
| 293 | |
Thieu Le | 85e050b | 2012-03-13 15:04:38 -0700 | [diff] [blame] | 294 | // The number of portal detections attempted for each pass. |
| 295 | // This includes both failure/timeout attempts and successful attempt |
| 296 | // (if any). |
| 297 | static const char kMetricPortalAttempts[]; |
| 298 | static const int kMetricPortalAttemptsMax; |
| 299 | static const int kMetricPortalAttemptsMin; |
| 300 | static const int kMetricPortalAttemptsNumBuckets; |
| 301 | |
| 302 | // The total number of portal detections attempted between the Connected |
| 303 | // state and the Online state. This includes both failure/timeout attempts |
| 304 | // and the final successful attempt. |
| 305 | static const char kMetricPortalAttemptsToOnline[]; |
| 306 | static const int kMetricPortalAttemptsToOnlineMax; |
| 307 | static const int kMetricPortalAttemptsToOnlineMin; |
| 308 | static const int kMetricPortalAttemptsToOnlineNumBuckets; |
| 309 | |
| 310 | // The result of the portal detection. |
| 311 | static const char kMetricPortalResult[]; |
| 312 | |
Wade Guthrie | 60a3706 | 2013-04-02 11:39:09 -0700 | [diff] [blame] | 313 | // Wifi connection frequencies. |
| 314 | static const char kMetricFrequenciesConnectedEver[]; |
| 315 | static const int kMetricFrequenciesConnectedMax; |
| 316 | static const int kMetricFrequenciesConnectedMin; |
| 317 | static const int kMetricFrequenciesConnectedNumBuckets; |
| 318 | |
Wade Guthrie | f22681f | 2013-05-31 11:46:31 -0700 | [diff] [blame] | 319 | static const char kMetricWiFiScanTimeInEbusyMilliseconds[]; |
| 320 | |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 321 | static const char kMetricPowerManagerKey[]; |
| 322 | |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 323 | // LinkMonitor statistics. |
| 324 | static const char kMetricLinkMonitorFailure[]; |
| 325 | static const char kMetricLinkMonitorResponseTimeSample[]; |
Paul Stewart | f1961f8 | 2012-09-11 20:45:39 -0700 | [diff] [blame] | 326 | static const int kMetricLinkMonitorResponseTimeSampleMin; |
| 327 | static const int kMetricLinkMonitorResponseTimeSampleMax; |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 328 | static const int kMetricLinkMonitorResponseTimeSampleNumBuckets; |
Paul Stewart | 0443aa5 | 2012-08-09 10:43:50 -0700 | [diff] [blame] | 329 | static const char kMetricLinkMonitorSecondsToFailure[]; |
Paul Stewart | f1961f8 | 2012-09-11 20:45:39 -0700 | [diff] [blame] | 330 | static const int kMetricLinkMonitorSecondsToFailureMin; |
| 331 | static const int kMetricLinkMonitorSecondsToFailureMax; |
Paul Stewart | 0443aa5 | 2012-08-09 10:43:50 -0700 | [diff] [blame] | 332 | static const int kMetricLinkMonitorSecondsToFailureNumBuckets; |
| 333 | static const char kMetricLinkMonitorBroadcastErrorsAtFailure[]; |
| 334 | static const char kMetricLinkMonitorUnicastErrorsAtFailure[]; |
Paul Stewart | f1961f8 | 2012-09-11 20:45:39 -0700 | [diff] [blame] | 335 | static const int kMetricLinkMonitorErrorCountMin; |
| 336 | static const int kMetricLinkMonitorErrorCountMax; |
Paul Stewart | 0443aa5 | 2012-08-09 10:43:50 -0700 | [diff] [blame] | 337 | static const int kMetricLinkMonitorErrorCountNumBuckets; |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 338 | |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 339 | static const char kMetricLinkClientDisconnectReason[]; |
| 340 | static const char kMetricLinkApDisconnectReason[]; |
| 341 | static const char kMetricLinkClientDisconnectType[]; |
| 342 | static const char kMetricLinkApDisconnectType[]; |
| 343 | |
Arman Uguray | 6d528f1 | 2012-09-13 13:44:55 -0700 | [diff] [blame] | 344 | // Shill termination action statistics. |
Arman Uguray | ab22c16 | 2012-10-08 19:08:38 -0700 | [diff] [blame] | 345 | static const char kMetricTerminationActionTimeOnTerminate[]; |
| 346 | static const char kMetricTerminationActionResultOnTerminate[]; |
| 347 | static const char kMetricTerminationActionTimeOnSuspend[]; |
| 348 | static const char kMetricTerminationActionResultOnSuspend[]; |
| 349 | static const int kMetricTerminationActionTimeMillisecondsMax; |
| 350 | static const int kMetricTerminationActionTimeMillisecondsMin; |
Arman Uguray | 6d528f1 | 2012-09-13 13:44:55 -0700 | [diff] [blame] | 351 | |
Paul Stewart | 85aea15 | 2013-01-22 09:31:56 -0800 | [diff] [blame] | 352 | // WiFiService Entry Fixup. |
| 353 | static const char kMetricServiceFixupEntries[]; |
| 354 | |
Thieu Le | 26fc01b | 2013-01-28 12:08:48 -0800 | [diff] [blame] | 355 | // Cellular specific statistics. |
Thieu Le | 7cf36b0 | 2013-01-30 17:15:56 -0800 | [diff] [blame] | 356 | static const char kMetricCellularAutoConnectTries[]; |
| 357 | static const int kMetricCellularAutoConnectTriesMax; |
| 358 | static const int kMetricCellularAutoConnectTriesMin; |
| 359 | static const int kMetricCellularAutoConnectTriesNumBuckets; |
| 360 | static const char kMetricCellularAutoConnectTotalTime[]; |
| 361 | static const int kMetricCellularAutoConnectTotalTimeMax; |
| 362 | static const int kMetricCellularAutoConnectTotalTimeMin; |
| 363 | static const int kMetricCellularAutoConnectTotalTimeNumBuckets; |
Thieu Le | 91fccf6 | 2013-04-22 15:23:16 -0700 | [diff] [blame] | 364 | static const char kMetricCellularDrop[]; |
| 365 | static const char kMetricCellularDropsPerHour[]; |
| 366 | static const int kMetricCellularDropsPerHourMax; |
| 367 | static const int kMetricCellularDropsPerHourMin; |
| 368 | static const int kMetricCellularDropsPerHourNumBuckets; |
| 369 | static const char kMetricCellularFailureReason[]; |
| 370 | static const char kMetricCellularOutOfCreditsReason[]; |
| 371 | static const char kMetricCellularSignalStrengthBeforeDrop[]; |
| 372 | static const int kMetricCellularSignalStrengthBeforeDropMax; |
| 373 | static const int kMetricCellularSignalStrengthBeforeDropMin; |
| 374 | static const int kMetricCellularSignalStrengthBeforeDropNumBuckets; |
Thieu Le | 26fc01b | 2013-01-28 12:08:48 -0800 | [diff] [blame] | 375 | |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame] | 376 | // Profile statistics. |
| 377 | static const char kMetricCorruptedProfile[]; |
| 378 | |
Paul Stewart | 91a43cb | 2013-03-02 21:34:15 -0800 | [diff] [blame] | 379 | // VPN connection statistics. |
| 380 | static const char kMetricVpnDriver[]; |
| 381 | static const int kMetricVpnDriverMax; |
| 382 | static const char kMetricVpnRemoteAuthenticationType[]; |
| 383 | static const int kMetricVpnRemoteAuthenticationTypeMax; |
| 384 | static const char kMetricVpnUserAuthenticationType[]; |
| 385 | static const int kMetricVpnUserAuthenticationTypeMax; |
| 386 | |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 387 | explicit Metrics(EventDispatcher *dispatcher); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 388 | virtual ~Metrics(); |
| 389 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 390 | // Converts the WiFi frequency into the associated UMA channel enumerator. |
| 391 | static WiFiChannel WiFiFrequencyToChannel(uint16 frequency); |
| 392 | |
Thieu Le | ad1ec2c | 2012-01-05 23:39:48 +0000 | [diff] [blame] | 393 | // Converts a flimflam security string into its UMA security enumerator. |
| 394 | static WiFiSecurity WiFiSecurityStringToEnum(const std::string &security); |
| 395 | |
Paul Stewart | 21f4096 | 2013-03-01 14:27:28 -0800 | [diff] [blame] | 396 | // Converts a flimflam EAP outer protocol string into its UMA enumerator. |
| 397 | static EapOuterProtocol EapOuterProtocolStringToEnum( |
| 398 | const std::string &outer); |
| 399 | |
| 400 | // Converts a flimflam EAP inner protocol string into its UMA enumerator. |
| 401 | static EapInnerProtocol EapInnerProtocolStringToEnum( |
| 402 | const std::string &inner); |
| 403 | |
Thieu Le | 85e050b | 2012-03-13 15:04:38 -0700 | [diff] [blame] | 404 | // Converts portal detection result to UMA portal result enumerator. |
| 405 | static PortalResult PortalDetectionResultToEnum( |
| 406 | const PortalDetector::Result &result); |
| 407 | |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 408 | // Starts this object. Call this during initialization. |
| 409 | virtual void Start(); |
| 410 | |
| 411 | // Stops this object. Call this during cleanup. |
| 412 | virtual void Stop(); |
| 413 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 414 | // Registers a service with this object so it can use the timers to track |
| 415 | // state transition metrics. |
| 416 | void RegisterService(const Service *service); |
| 417 | |
| 418 | // Deregisters the service from this class. All state transition timers |
| 419 | // will be removed. |
| 420 | void DeregisterService(const Service *service); |
| 421 | |
| 422 | // Tracks the time it takes |service| to go from |start_state| to |
| 423 | // |stop_state|. When |stop_state| is reached, the time is sent to UMA. |
| 424 | void AddServiceStateTransitionTimer(const Service *service, |
| 425 | const std::string &histogram_name, |
| 426 | Service::ConnectState start_state, |
| 427 | Service::ConnectState stop_state); |
| 428 | |
| 429 | // Specializes |metric_name| for the specified |technology_id|. |
| 430 | std::string GetFullMetricName(const char *metric_name, |
| 431 | Technology::Identifier technology_id); |
| 432 | |
| 433 | // Notifies this object that the default service has changed. |
| 434 | // |service| is the new default service. |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 435 | virtual void NotifyDefaultServiceChanged(const Service *service); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 436 | |
| 437 | // Notifies this object that |service| state has changed. |
| 438 | virtual void NotifyServiceStateChanged(const Service *service, |
| 439 | Service::ConnectState new_state); |
| 440 | |
Thieu Le | 67370f6 | 2012-02-14 23:01:42 +0000 | [diff] [blame] | 441 | // Notifies this object that |service| has been disconnected. |
| 442 | void NotifyServiceDisconnect(const Service *service); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 443 | |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 444 | // Notifies this object of a power management state change. |
| 445 | void NotifyPowerStateChange(PowerManager::SuspendState new_state); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 446 | |
Arman Uguray | ab22c16 | 2012-10-08 19:08:38 -0700 | [diff] [blame] | 447 | // Notifies this object that termination actions started executing. |
| 448 | void NotifyTerminationActionsStarted(TerminationActionReason reason); |
| 449 | |
| 450 | // Notifies this object that termination actions have been completed. |
| 451 | // |success| is true, if the termination actions completed successfully. |
| 452 | void NotifyTerminationActionsCompleted( |
| 453 | TerminationActionReason reason, bool success); |
| 454 | |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 455 | // Notifies this object of a failure in LinkMonitor. |
| 456 | void NotifyLinkMonitorFailure( |
Paul Stewart | 0443aa5 | 2012-08-09 10:43:50 -0700 | [diff] [blame] | 457 | Technology::Identifier technology, |
| 458 | LinkMonitorFailure failure, |
Paul Stewart | f1961f8 | 2012-09-11 20:45:39 -0700 | [diff] [blame] | 459 | int seconds_to_failure, |
| 460 | int broadcast_error_count, |
| 461 | int unicast_error_count); |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 462 | |
| 463 | // Notifies this object that LinkMonitor has added a response time sample |
| 464 | // for |connection| with a value of |response_time_milliseconds|. |
| 465 | void NotifyLinkMonitorResponseTimeSampleAdded( |
| 466 | Technology::Identifier technology, |
Paul Stewart | f1961f8 | 2012-09-11 20:45:39 -0700 | [diff] [blame] | 467 | int response_time_milliseconds); |
Paul Stewart | ff845fc | 2012-08-07 07:28:44 -0700 | [diff] [blame] | 468 | |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 469 | // Notifies this object of WiFi disconnect. |
| 470 | void Notify80211Disconnect(WiFiDisconnectByWhom by_whom, |
| 471 | IEEE_80211::WiFiReasonCode reason); |
| 472 | |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 473 | // Registers a device with this object so the device can use the timers to |
| 474 | // track state transition metrics. |
| 475 | void RegisterDevice(int interface_index, |
| 476 | Technology::Identifier technology); |
| 477 | |
Thieu Le | 9abd674 | 2013-01-23 23:35:37 -0800 | [diff] [blame] | 478 | // Checks to see if the device has already been registered. |
| 479 | bool IsDeviceRegistered(int interface_index, |
| 480 | Technology::Identifier technology); |
| 481 | |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 482 | // Deregisters the device from this class. All state transition timers |
| 483 | // will be removed. |
| 484 | void DeregisterDevice(int interface_index); |
| 485 | |
| 486 | // Notifies this object that a device has been initialized. |
| 487 | void NotifyDeviceInitialized(int interface_index); |
| 488 | |
Thieu Le | ce4483e | 2013-01-23 15:12:03 -0800 | [diff] [blame] | 489 | // Notifies this object that a device has started the enable process. |
| 490 | void NotifyDeviceEnableStarted(int interface_index); |
| 491 | |
| 492 | // Notifies this object that a device has completed the enable process. |
| 493 | void NotifyDeviceEnableFinished(int interface_index); |
| 494 | |
Thieu Le | a2519bf | 2013-01-23 16:51:54 -0800 | [diff] [blame] | 495 | // Notifies this object that a device has started the disable process. |
| 496 | void NotifyDeviceDisableStarted(int interface_index); |
| 497 | |
| 498 | // Notifies this object that a device has completed the disable process. |
| 499 | void NotifyDeviceDisableFinished(int interface_index); |
| 500 | |
Thieu Le | 18c1107 | 2013-01-28 17:21:37 -0800 | [diff] [blame] | 501 | // Notifies this object that a device has started the scanning process. |
| 502 | void NotifyDeviceScanStarted(int interface_index); |
| 503 | |
| 504 | // Notifies this object that a device has completed the scanning process. |
Wade Guthrie | 5a4e2ef | 2013-04-30 12:51:39 -0700 | [diff] [blame] | 505 | virtual void NotifyDeviceScanFinished(int interface_index); |
Thieu Le | 18c1107 | 2013-01-28 17:21:37 -0800 | [diff] [blame] | 506 | |
Thieu Le | cdb5a21 | 2013-01-25 11:17:18 -0800 | [diff] [blame] | 507 | // Notifies this object that a device has started the connect process. |
Thieu Le | 7cf36b0 | 2013-01-30 17:15:56 -0800 | [diff] [blame] | 508 | void NotifyDeviceConnectStarted(int interface_index, |
| 509 | bool is_auto_connecting); |
Thieu Le | cdb5a21 | 2013-01-25 11:17:18 -0800 | [diff] [blame] | 510 | |
| 511 | // Notifies this object that a device has completed the connect process. |
| 512 | void NotifyDeviceConnectFinished(int interface_index); |
| 513 | |
Thieu Le | 26fc01b | 2013-01-28 12:08:48 -0800 | [diff] [blame] | 514 | // Notifies this object that a cellular device has been dropped by the |
| 515 | // network. |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 516 | void NotifyCellularDeviceDrop(int interface_index, |
| 517 | const std::string &network_technology, |
Thieu Le | 26fc01b | 2013-01-28 12:08:48 -0800 | [diff] [blame] | 518 | uint16 signal_strength); |
| 519 | |
Thieu Le | b7aa5f7 | 2013-01-31 15:57:48 -0800 | [diff] [blame] | 520 | // Notifies this object about a cellular device failure code. |
| 521 | void NotifyCellularDeviceFailure(const Error &error); |
| 522 | |
Thieu Le | 91fccf6 | 2013-04-22 15:23:16 -0700 | [diff] [blame] | 523 | // Notifies this object that a cellular service has been marked as |
| 524 | // out-of-credits. |
| 525 | void NotifyCellularOutOfCredits(Metrics::CellularOutOfCreditsReason reason); |
| 526 | |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame] | 527 | // Notifies this object about a corrupted profile. |
| 528 | virtual void NotifyCorruptedProfile(); |
| 529 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 530 | // Sends linear histogram data to UMA. |
Thieu Le | 85e050b | 2012-03-13 15:04:38 -0700 | [diff] [blame] | 531 | virtual bool SendEnumToUMA(const std::string &name, int sample, int max); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 532 | |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 533 | // Send histogram data to UMA. |
Thieu Le | 85e050b | 2012-03-13 15:04:38 -0700 | [diff] [blame] | 534 | virtual bool SendToUMA(const std::string &name, int sample, int min, |
| 535 | int max, int num_buckets); |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 536 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 537 | private: |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 538 | friend class MetricsTest; |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 539 | FRIEND_TEST(MetricsTest, CellularDropsPerHour); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 540 | FRIEND_TEST(MetricsTest, FrequencyToChannel); |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 541 | FRIEND_TEST(MetricsTest, ServiceFailure); |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 542 | FRIEND_TEST(MetricsTest, TimeOnlineTimeToDrop); |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 543 | FRIEND_TEST(MetricsTest, TimeToConfig); |
| 544 | FRIEND_TEST(MetricsTest, TimeToOnline); |
| 545 | FRIEND_TEST(MetricsTest, TimeToPortal); |
Thieu Le | 18c1107 | 2013-01-28 17:21:37 -0800 | [diff] [blame] | 546 | FRIEND_TEST(MetricsTest, TimeToScanIgnore); |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 547 | FRIEND_TEST(MetricsTest, WiFiServiceChannel); |
| 548 | FRIEND_TEST(MetricsTest, WiFiServicePostReady); |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 549 | FRIEND_TEST(WiFiMainTest, GetGeolocationObjects); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 550 | |
| 551 | typedef ScopedVector<chromeos_metrics::TimerReporter> TimerReporters; |
| 552 | typedef std::list<chromeos_metrics::TimerReporter *> TimerReportersList; |
| 553 | typedef std::map<Service::ConnectState, TimerReportersList> |
| 554 | TimerReportersByState; |
| 555 | struct ServiceMetrics { |
| 556 | ServiceMetrics() : service(NULL) {} |
| 557 | // The service is registered/deregistered in the Service |
| 558 | // constructor/destructor, therefore there is no need to keep a ref count. |
| 559 | const Service *service; |
| 560 | // All TimerReporter objects are stored in |timers| which owns the objects. |
| 561 | // |start_on_state| and |stop_on_state| contain pointers to the |
| 562 | // TimerReporter objects and control when to start and stop the timers. |
| 563 | TimerReporters timers; |
| 564 | TimerReportersByState start_on_state; |
| 565 | TimerReportersByState stop_on_state; |
| 566 | }; |
| 567 | typedef std::map<const Service *, std::tr1::shared_ptr<ServiceMetrics> > |
| 568 | ServiceMetricsLookupMap; |
| 569 | |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 570 | struct DeviceMetrics { |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 571 | DeviceMetrics() : auto_connect_tries(0), num_drops(0) {} |
Thieu Le | 9abd674 | 2013-01-23 23:35:37 -0800 | [diff] [blame] | 572 | Technology::Identifier technology; |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 573 | scoped_ptr<chromeos_metrics::TimerReporter> initialization_timer; |
Thieu Le | ce4483e | 2013-01-23 15:12:03 -0800 | [diff] [blame] | 574 | scoped_ptr<chromeos_metrics::TimerReporter> enable_timer; |
Thieu Le | a2519bf | 2013-01-23 16:51:54 -0800 | [diff] [blame] | 575 | scoped_ptr<chromeos_metrics::TimerReporter> disable_timer; |
Thieu Le | 18c1107 | 2013-01-28 17:21:37 -0800 | [diff] [blame] | 576 | scoped_ptr<chromeos_metrics::TimerReporter> scan_timer; |
Thieu Le | cdb5a21 | 2013-01-25 11:17:18 -0800 | [diff] [blame] | 577 | scoped_ptr<chromeos_metrics::TimerReporter> connect_timer; |
Thieu Le | 7cf36b0 | 2013-01-30 17:15:56 -0800 | [diff] [blame] | 578 | scoped_ptr<chromeos_metrics::TimerReporter> auto_connect_timer; |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 579 | int auto_connect_tries; |
| 580 | int num_drops; |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 581 | }; |
| 582 | typedef std::map<const int, std::tr1::shared_ptr<DeviceMetrics> > |
| 583 | DeviceMetricsLookupMap; |
| 584 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 585 | static const uint16 kWiFiBandwidth5MHz; |
| 586 | static const uint16 kWiFiBandwidth20MHz; |
| 587 | static const uint16 kWiFiFrequency2412; |
| 588 | static const uint16 kWiFiFrequency2472; |
| 589 | static const uint16 kWiFiFrequency2484; |
| 590 | static const uint16 kWiFiFrequency5170; |
| 591 | static const uint16 kWiFiFrequency5180; |
| 592 | static const uint16 kWiFiFrequency5230; |
| 593 | static const uint16 kWiFiFrequency5240; |
| 594 | static const uint16 kWiFiFrequency5320; |
| 595 | static const uint16 kWiFiFrequency5500; |
| 596 | static const uint16 kWiFiFrequency5700; |
| 597 | static const uint16 kWiFiFrequency5745; |
| 598 | static const uint16 kWiFiFrequency5825; |
| 599 | |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 600 | static const int kHourlyTimeoutMilliseconds; |
| 601 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 602 | void InitializeCommonServiceMetrics(const Service *service); |
| 603 | void UpdateServiceStateTransitionMetrics(ServiceMetrics *service_metrics, |
| 604 | Service::ConnectState new_state); |
| 605 | void SendServiceFailure(const Service *service); |
| 606 | |
Wade Guthrie | 60a3706 | 2013-04-02 11:39:09 -0700 | [diff] [blame] | 607 | DeviceMetrics *GetDeviceMetrics(int interface_index) const; |
Thieu Le | 7cf36b0 | 2013-01-30 17:15:56 -0800 | [diff] [blame] | 608 | void AutoConnectMetricsReset(DeviceMetrics *device_metrics); |
Thieu Le | ce4483e | 2013-01-23 15:12:03 -0800 | [diff] [blame] | 609 | |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 610 | void HourlyTimeoutHandler(); |
| 611 | |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 612 | // For unit test purposes. |
| 613 | void set_library(MetricsLibraryInterface *library); |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 614 | void set_time_online_timer(chromeos_metrics::Timer *timer) { |
| 615 | time_online_timer_.reset(timer); // Passes ownership |
| 616 | } |
| 617 | void set_time_to_drop_timer(chromeos_metrics::Timer *timer) { |
| 618 | time_to_drop_timer_.reset(timer); // Passes ownership |
| 619 | } |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 620 | void set_time_resume_to_ready_timer(chromeos_metrics::Timer *timer) { |
| 621 | time_resume_to_ready_timer_.reset(timer); // Passes ownership |
| 622 | } |
Arman Uguray | ab22c16 | 2012-10-08 19:08:38 -0700 | [diff] [blame] | 623 | void set_time_termination_actions_timer( |
| 624 | chromeos_metrics::Timer *timer) { |
| 625 | time_termination_actions_timer.reset(timer); // Passes ownership |
| 626 | } |
Thieu Le | 18c1107 | 2013-01-28 17:21:37 -0800 | [diff] [blame] | 627 | void set_time_to_scan_timer(int interface_index, |
| 628 | chromeos_metrics::TimerReporter *timer) { |
| 629 | DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index); |
| 630 | device_metrics->scan_timer.reset(timer); // Passes ownership |
| 631 | } |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 632 | |
| 633 | // |library_| points to |metrics_library_| when shill runs normally. |
| 634 | // However, in order to allow for unit testing, we point |library_| to a |
| 635 | // MetricsLibraryMock object instead. |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 636 | EventDispatcher *dispatcher_; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 637 | MetricsLibrary metrics_library_; |
| 638 | MetricsLibraryInterface *library_; |
| 639 | ServiceMetricsLookupMap services_metrics_; |
Thieu Le | a20cbc2 | 2012-01-09 22:01:43 +0000 | [diff] [blame] | 640 | Technology::Identifier last_default_technology_; |
| 641 | bool was_online_; |
| 642 | scoped_ptr<chromeos_metrics::Timer> time_online_timer_; |
| 643 | scoped_ptr<chromeos_metrics::Timer> time_to_drop_timer_; |
Thieu Le | b84ba34 | 2012-03-02 15:15:19 -0800 | [diff] [blame] | 644 | scoped_ptr<chromeos_metrics::Timer> time_resume_to_ready_timer_; |
Arman Uguray | ab22c16 | 2012-10-08 19:08:38 -0700 | [diff] [blame] | 645 | scoped_ptr<chromeos_metrics::Timer> time_termination_actions_timer; |
Darin Petkov | 58f0b6d | 2012-06-12 12:52:30 +0200 | [diff] [blame] | 646 | bool collect_bootstats_; |
Thieu Le | c8078a6 | 2013-01-22 18:01:12 -0800 | [diff] [blame] | 647 | DeviceMetricsLookupMap devices_metrics_; |
Thieu Le | 6c1e3bb | 2013-02-06 15:20:35 -0800 | [diff] [blame] | 648 | base::CancelableClosure hourly_timeout_handler_; |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 649 | |
| 650 | DISALLOW_COPY_AND_ASSIGN(Metrics); |
| 651 | }; |
| 652 | |
| 653 | } // namespace shill |
| 654 | |
Wade Guthrie | 60a3706 | 2013-04-02 11:39:09 -0700 | [diff] [blame] | 655 | #endif // SHILL_METRICS_H_ |