mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 12:34:31 +00:00
metric_events & src: add metric for VcpuShutdown.
Add a metric to report VcpuShutdowns. BUG=b:340719884 TEST=builds Change-Id: I70115458167fe487696fdc64657c745a93e4c36a Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5585672 Commit-Queue: Noah Gold <nkgold@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
220731b686
commit
c8194324ab
5 changed files with 20 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -805,6 +805,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"merge",
|
"merge",
|
||||||
"metrics",
|
"metrics",
|
||||||
|
"metrics_events",
|
||||||
"minijail",
|
"minijail",
|
||||||
"net_util",
|
"net_util",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
|
|
@ -462,6 +462,7 @@ libcras = "*"
|
||||||
log = { version = "0", features = ["release_max_level_debug"]}
|
log = { version = "0", features = ["release_max_level_debug"]}
|
||||||
merge = "0.1.0"
|
merge = "0.1.0"
|
||||||
metrics = { path = "metrics" }
|
metrics = { path = "metrics" }
|
||||||
|
metrics_events = { path = "metrics_events" }
|
||||||
net_util = { path = "net_util" }
|
net_util = { path = "net_util" }
|
||||||
once_cell = "1.7"
|
once_cell = "1.7"
|
||||||
protobuf = { version = "3.2", optional = true }
|
protobuf = { version = "3.2", optional = true }
|
||||||
|
|
|
@ -49,6 +49,7 @@ pub enum MetricEventType {
|
||||||
VirtioWakeup {
|
VirtioWakeup {
|
||||||
virtio_id: u32,
|
virtio_id: u32,
|
||||||
},
|
},
|
||||||
|
VcpuShutdownError,
|
||||||
Other(i64),
|
Other(i64),
|
||||||
Vendor(VendorMetricEventType),
|
Vendor(VendorMetricEventType),
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ use hypervisor::IoParams;
|
||||||
use hypervisor::VcpuExit;
|
use hypervisor::VcpuExit;
|
||||||
use hypervisor::VcpuSignalHandle;
|
use hypervisor::VcpuSignalHandle;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
use metrics_events::MetricEventType;
|
||||||
#[cfg(target_arch = "riscv64")]
|
#[cfg(target_arch = "riscv64")]
|
||||||
use riscv64::Riscv64 as Arch;
|
use riscv64::Riscv64 as Arch;
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
@ -389,7 +390,15 @@ where
|
||||||
}
|
}
|
||||||
Ok(VcpuExit::IrqWindowOpen) => {}
|
Ok(VcpuExit::IrqWindowOpen) => {}
|
||||||
Ok(VcpuExit::Hlt) => irq_chip.halted(cpu_id),
|
Ok(VcpuExit::Hlt) => irq_chip.halted(cpu_id),
|
||||||
Ok(VcpuExit::Shutdown(_)) => return ExitState::Stop,
|
Ok(VcpuExit::Shutdown(reason)) => {
|
||||||
|
if let Err(e) = reason {
|
||||||
|
metrics::log_descriptor(
|
||||||
|
MetricEventType::VcpuShutdownError,
|
||||||
|
e.get_raw_error_code() as i64,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ExitState::Stop;
|
||||||
|
}
|
||||||
Ok(VcpuExit::FailEntry {
|
Ok(VcpuExit::FailEntry {
|
||||||
hardware_entry_failure_reason,
|
hardware_entry_failure_reason,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
|
@ -66,6 +66,7 @@ use hypervisor::IoOperation;
|
||||||
use hypervisor::IoParams;
|
use hypervisor::IoParams;
|
||||||
use hypervisor::VcpuExit;
|
use hypervisor::VcpuExit;
|
||||||
use hypervisor::VcpuInitX86_64;
|
use hypervisor::VcpuInitX86_64;
|
||||||
|
use metrics_events::MetricEventType;
|
||||||
use sync::Condvar;
|
use sync::Condvar;
|
||||||
use sync::Mutex;
|
use sync::Mutex;
|
||||||
use vm_control::VcpuControl;
|
use vm_control::VcpuControl;
|
||||||
|
@ -832,6 +833,12 @@ where
|
||||||
// with Shutdown. Normal reboots and shutdowns, like window close, use
|
// with Shutdown. Normal reboots and shutdowns, like window close, use
|
||||||
// the vm event tube and VmRunMode::Exiting instead of VcpuExit::Shutdown.
|
// the vm event tube and VmRunMode::Exiting instead of VcpuExit::Shutdown.
|
||||||
Ok(VcpuExit::Shutdown(reason)) => {
|
Ok(VcpuExit::Shutdown(reason)) => {
|
||||||
|
if let Err(e) = reason {
|
||||||
|
metrics::log_descriptor(
|
||||||
|
MetricEventType::VcpuShutdownError,
|
||||||
|
e.get_raw_error_code() as i64,
|
||||||
|
);
|
||||||
|
}
|
||||||
bail_exit_code!(Exit::VcpuShutdown, "vcpu shutdown (reason: {:?})", reason)
|
bail_exit_code!(Exit::VcpuShutdown, "vcpu shutdown (reason: {:?})", reason)
|
||||||
}
|
}
|
||||||
Ok(VcpuExit::FailEntry {
|
Ok(VcpuExit::FailEntry {
|
||||||
|
|
Loading…
Reference in a new issue