diff --git a/src/sysboostd/Cargo.toml b/src/sysboostd/Cargo.toml index d763b90b889e89c8ce8602501a17fc4442def85d..8191b19e081afeec812338d1d818c593927597a4 100644 --- a/src/sysboostd/Cargo.toml +++ b/src/sysboostd/Cargo.toml @@ -28,4 +28,7 @@ rust-ini = "0.20.0" version = "3.2.0" [dependencies.libc] -version = "0.2" \ No newline at end of file +version = "0.2" + +[dependencies] +chrono = "0.4" \ No newline at end of file diff --git a/src/sysboostd/interface.rs b/src/sysboostd/interface.rs index d3ef53ccff9699bf0e4e946ad8402c32111a16c3..c2474815e8d0375893942739cee64c2578c215dd 100644 --- a/src/sysboostd/interface.rs +++ b/src/sysboostd/interface.rs @@ -10,6 +10,9 @@ use crate::coredump_monitor::set_mode; use crate::lib::process_ext::run_child; use crate::daemon::{SYSBOOST_DB_PATH, self}; +use chrono::Utc; +use chrono::TimeZone; + pub const OPTIMIZED_ELF_LOG: &str = "/etc/sysboost.d/.optimized.log"; pub fn write_back_config(name: &str) -> i32 { @@ -26,7 +29,8 @@ pub fn write_back_config(name: &str) -> i32 { return -1; } }; - let content = format!("{}\n", name); + let now = Utc::now(); + let content = format!("{} optimized elf: {}\n", now.format("%Y-%m-%d %H:%M:%S"), name); match file.write_all(content.as_bytes()) { Ok(_) => {return 0;} Err(e) => { @@ -153,4 +157,4 @@ pub fn stop_one_elf(path: &str) -> i32 { } } 0 -} \ No newline at end of file +}