Skip to content

Commit 4addef5

Browse files
committed
Add timestamp in GuestEvent
1 parent b798179 commit 4addef5

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

vmm/rpc/proto/vmm_rpc.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ message VmInfo {
4242
message GuestEvent {
4343
string event = 1;
4444
string body = 2;
45+
// Timestamp in milliseconds since Unix epoch
46+
uint64 timestamp = 3;
4547
}
4648

4749
message Id {

vmm/src/app.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use std::collections::{BTreeSet, HashMap, VecDeque};
2121
use std::net::IpAddr;
2222
use std::path::{Path, PathBuf};
2323
use std::sync::{Arc, Mutex, MutexGuard};
24+
use std::time::SystemTime;
2425
use supervisor_client::SupervisorClient;
2526
use tracing::{error, info};
2627

@@ -414,6 +415,10 @@ impl App {
414415
vm.state.events.push_back(pb::GuestEvent {
415416
event: event.into(),
416417
body: body.clone(),
418+
timestamp: SystemTime::now()
419+
.duration_since(SystemTime::UNIX_EPOCH)
420+
.unwrap_or_default()
421+
.as_millis() as u64,
417422
});
418423
while vm.state.events.len() > self.config.event_buffer_size {
419424
vm.state.events.pop_front();

0 commit comments

Comments
 (0)