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

Side by Side Diff: content/browser/bluetooth/bluetooth_metrics.h

Issue 1265323004: bluetooth: Move histogram related code to its own file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uma-get-primary-service
Patch Set: Remove class, small fixes, remove logging for errors that return a similar message Created 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
7
8 #include <vector>
9
10 namespace base {
11 class TimeDelta;
12 }
13
14 namespace device {
15 class BluetoothUUID;
16 }
17
18 namespace content {
19 struct BluetoothScanFilter;
20
21 // General
22 enum class UMAWebBluetoothFunction {
23 REQUEST_DEVICE = 0,
24 CONNECT_GATT = 1,
25 GET_PRIMARY_SERVICE = 2,
26 GET_CHARACTERISTIC = 3,
27 CHARACTERISTIC_READ_VALUE = 4,
28 CHARACTERISTIC_WRITE_VALUE = 5,
29 // NOTE: Add new actions immediately above this line. Make sure to update
30 // the enum list in tools/metrics/histograms/histograms.xml accordingly.
31 COUNT
32 };
33
34 // There should be a call to this function for every call to the Web Bluetooth
35 // API.
36 void RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction function);
37
38 // requestDevice()
39 enum class UMARequestDeviceOutcome {
40 SUCCESS = 0,
41 NO_BLUETOOTH_ADAPTER = 1,
42 NO_RENDER_FRAME = 2,
43 DISCOVERY_START_FAILED = 3,
44 DISCOVERY_STOP_FAILED = 4,
45 NO_MATCHING_DEVICES_FOUND = 5,
46 BLUETOOTH_ADAPTER_NOT_PRESENT = 6,
47 BLUETOOTH_ADAPTER_OFF = 7,
48 // NOTE: Add new requestDevice() outcomes immediately above this line. Make
49 // sure to update the enum list in
50 // tools/metrics/histograms/histograms.xml accordingly.
51 COUNT
52 };
53 // There should be a call to this function before every
54 // Send(BluetoothMsg_RequestDeviceSuccess...) or
55 // Send(BluetoothMsg_RequestDeviceError...).
56 void RecordRequestDeviceOutcome(UMARequestDeviceOutcome outcome);
57
58 // Records stats about the arguments used when calling requestDevice.
59 // - The number of filters used.
60 // - The size of each filter.
61 // - UUID of the services used in filters.
62 // - Number of optional services used.
63 // - UUID of the optional services.
64 // - Size of the union of all services.
65 void RecordRequestDeviceArguments(
66 const std::vector<content::BluetoothScanFilter>& filters,
67 const std::vector<device::BluetoothUUID>& optional_services);
68
69 // connectGATT()
70 enum class UMAConnectGATTOutcome {
71 SUCCESS = 0,
72 NO_DEVICE = 1,
73 UNKNOWN = 2,
74 IN_PROGRESS = 3,
75 FAILED = 4,
76 AUTH_FAILED = 5,
77 AUTH_CANCELED = 6,
78 AUTH_REJECTED = 7,
79 AUTH_TIMEOUT = 8,
80 UNSUPPORTED_DEVICE = 9,
81 // Note: Add new ConnectGATT outcomes immediately above this line. Make sure
82 // to update the enum list in tools/metrics/histograms/histograms.xml
83 // accordingly.
84 COUNT
85 };
86 // There should be a call to this function before every
87 // Send(BluetoothMsg_ConnectGATTSuccess) and
88 // Send(BluetoothMsg_ConnectGATTError).
89 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome);
90 // Records how long it took for the connection to succeed.
91 void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration);
92 // Records how long it took for the connection to fail.
93 void RecordConnectGATTTimeFailed(const base::TimeDelta& duration);
94
95 // getPrimaryService()
96 enum class UMAGetPrimaryServiceOutcome {
97 SUCCESS = 0,
98 NO_DEVICE = 1,
99 NOT_FOUND = 2,
100 // Note: Add new GetPrimaryService outcomes immediately above this line.
101 // Make sure to update the enum list in
102 // tools/metrics/histograms/histograms.xml accordingly.
103 COUNT
104 };
105 // Record the service uuid used when calling getPrimaryService.
106 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service);
107 // There should be a call to this function for every call to
108 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and
109 // Send(BluetoothMsg_GetPrimaryServiceError).
110 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome);
111
112 // read/write characteristics
113 // TODO(ortuno): For now we are just copying over the code to record these
114 // errors but a follow up CL will add a function for each operation.
115
116 // These types of errors aren't as common. We log them to understand
117 // how common they are and if we need to investigate more.
118 enum class UMAGATTError {
119 UNKNOWN = 0,
120 FAILED = 1,
121 IN_PROGRESS = 2,
122 NOT_PAIRED = 3,
123 // Note: Add new GATT Errors immediately above this line.
124 // Make sure to update the enum list in
125 // tools/metrics/histograms/histograms.xml accordingly.
126 MAX_ERROR,
127 };
128 // Records the GATT Error the function returned.
129 void RecordGATTError(UMAGATTError error);
130
131 } // namespace content
132
133 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698