OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 #include "content/browser/bluetooth/bluetooth_metrics.h" | 5 #include "content/browser/bluetooth/bluetooth_metrics.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 UMA_HISTOGRAM_ENUMERATION( | 132 UMA_HISTOGRAM_ENUMERATION( |
133 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), | 133 "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome), |
134 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); | 134 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); |
135 } | 135 } |
136 | 136 |
137 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { | 137 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { |
138 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", | 138 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", |
139 HashUUID(characteristic)); | 139 HashUUID(characteristic)); |
140 } | 140 } |
141 | 141 |
142 // read/write characteristic | 142 // GATT Operations |
143 | 143 |
144 void RecordGATTError(UMAGATTError error) { | 144 void RecordGATTOperationOutcome(UMAGATTOperation operation, |
145 UMA_HISTOGRAM_ENUMERATION("Bluetooth.GATTErrors", static_cast<int>(error), | 145 UMAGATTOperationOutcome outcome) { |
146 static_cast<int>(UMAGATTError::MAX_ERROR)); | 146 switch (operation) { |
| 147 case UMAGATTOperation::CHARACTERISTIC_READ: |
| 148 RecordCharacteristicReadValueOutcome(outcome); |
| 149 return; |
| 150 case UMAGATTOperation::CHARACTERISTIC_WRITE: |
| 151 RecordCharacteristicWriteValueOutcome(outcome); |
| 152 return; |
| 153 case UMAGATTOperation::COUNT: |
| 154 NOTREACHED(); |
| 155 return; |
| 156 } |
| 157 NOTREACHED(); |
| 158 } |
| 159 |
| 160 // Characteristic.readValue |
| 161 |
| 162 // static |
| 163 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) { |
| 164 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome", |
| 165 static_cast<int>(outcome), |
| 166 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
| 167 } |
| 168 |
| 169 // Characteristic.writeValue |
| 170 |
| 171 void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome outcome) { |
| 172 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.WriteValue.Outcome", |
| 173 static_cast<int>(outcome), |
| 174 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
147 } | 175 } |
148 | 176 |
149 } // namespace content | 177 } // namespace content |
OLD | NEW |