forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamepad_uma.cc
29 lines (22 loc) · 938 Bytes
/
gamepad_uma.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/gamepad/gamepad_uma.h"
#include <type_traits>
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "device/gamepad/gamepad_id_list.h"
namespace device {
void RecordConnectedGamepad(GamepadId gamepad_id) {
// Avoid recording metrics for non-gamepads.
if (gamepad_id == GamepadId::kUnknownGamepad)
return;
auto gamepad_id_as_underlying_type =
static_cast<std::underlying_type<GamepadId>::type>(gamepad_id);
base::UmaHistogramSparse("Gamepad.KnownGamepadConnectedWithId",
int32_t{gamepad_id_as_underlying_type});
}
void RecordUnknownGamepad(GamepadSource source) {
UMA_HISTOGRAM_ENUMERATION("Gamepad.UnknownGamepadConnected", source);
}
} // namespace device