xref: /aosp_15_r20/external/crosvm/metrics_events/src/event_types.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2024 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 use metrics_events_product::MetricEventType as VendorMetricEventType;
6 use serde::Deserialize;
7 use serde::Serialize;
8 
9 #[cfg(windows)]
10 use crate::sys::windows::WaveFormatDetails;
11 
12 // TODO(mikehoyle): Create a way to generate these directly from the
13 // proto for a single source-of-truth.
14 #[derive(Clone, Debug, Serialize, Deserialize)]
15 pub enum MetricEventType {
16     CpuUsage,
17     MemoryUsage,
18     Fps,
19     JankyFps,
20     NetworkTxRate,
21     NetworkRxRate,
22     Interrupts,
23     FrameTime,
24     EmulatorGraphicsFreeze,
25     EmulatorGraphicsUnfreeze,
26     EmulatorGfxstreamVkAbortReason,
27     ChildProcessExit {
28         exit_code: u32,
29         #[cfg(windows)]
30         process_type: win_util::ProcessType,
31     },
32     ReadIo,
33     WriteIo,
34     #[cfg(windows)]
35     AudioFormatRequestOk(WaveFormatDetails),
36     #[cfg(windows)]
37     AudioFormatModifiedOk(WaveFormatDetails),
38     #[cfg(windows)]
39     AudioFormatFailed(WaveFormatDetails),
40     TscCoresOutOfSync,
41     NetworkTxRateSummarized,
42     NetworkRxRateSummarized,
43     DllLoaded(String),
44     GraphicsHangRenderThread,
45     GraphicsHangSyncThread,
46     AudioNoopStreamForced,
47     AudioPlaybackError,
48     RtcWakeup,
49     VirtioWakeup {
50         virtio_id: u32,
51     },
52     VcpuShutdownError,
53     Other(i64),
54     Vendor(VendorMetricEventType),
55 }
56