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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2024 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use metrics_events_product::MetricEventType as VendorMetricEventType;
use serde::Deserialize;
use serde::Serialize;

#[cfg(windows)]
use crate::sys::windows::WaveFormatDetails;

// TODO(mikehoyle): Create a way to generate these directly from the
// proto for a single source-of-truth.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum MetricEventType {
    CpuUsage,
    MemoryUsage,
    Fps,
    JankyFps,
    NetworkTxRate,
    NetworkRxRate,
    Interrupts,
    FrameTime,
    EmulatorGraphicsFreeze,
    EmulatorGraphicsUnfreeze,
    EmulatorGfxstreamVkAbortReason,
    ChildProcessExit {
        exit_code: u32,
        #[cfg(windows)]
        process_type: win_util::ProcessType,
    },
    ReadIo,
    WriteIo,
    #[cfg(windows)]
    AudioFormatRequestOk(WaveFormatDetails),
    #[cfg(windows)]
    AudioFormatModifiedOk(WaveFormatDetails),
    #[cfg(windows)]
    AudioFormatFailed(WaveFormatDetails),
    TscCoresOutOfSync,
    NetworkTxRateSummarized,
    NetworkRxRateSummarized,
    DllLoaded(String),
    GraphicsHangRenderThread,
    GraphicsHangSyncThread,
    AudioNoopStreamForced,
    AudioPlaybackError,
    RtcWakeup,
    VirtioWakeup {
        virtio_id: u32,
    },
    VcpuShutdownError,
    Other(i64),
    Vendor(VendorMetricEventType),
}