mirror of
https://github.com/uutils/procps.git
synced 2026-06-10 16:14:00 -07:00
Merge pull request #686 from Franklin-Qi/fix-#685-optimize-time-format-display-for-hugetop-command
hugetop: optimize time format display
This commit is contained in:
Generated
+1
@@ -2345,6 +2345,7 @@ dependencies = [
|
||||
name = "uu_hugetop"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"tempfile",
|
||||
"uucore 0.7.0",
|
||||
|
||||
@@ -14,6 +14,7 @@ version.workspace = true
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
chrono = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
uucore = { workspace = true }
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use chrono::{DateTime, Local};
|
||||
use clap::{value_parser, Arg, Command};
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::thread::sleep;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use std::time::Duration;
|
||||
use uucore::error::UResult;
|
||||
|
||||
const DEFAULT_HUGEPAGES_ROOT: &str = "/sys/kernel/mm/hugepages";
|
||||
@@ -122,12 +123,8 @@ pub fn uu_app() -> Command {
|
||||
}
|
||||
|
||||
fn print_summary(numa: bool, human: bool) {
|
||||
let now = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map(|d| d.as_secs())
|
||||
.unwrap_or_default();
|
||||
|
||||
println!("hugetop - {}", now);
|
||||
let now: DateTime<Local> = Local::now();
|
||||
println!("hugetop - {}", now.format("%a %b %e %T %Y"));
|
||||
|
||||
let pools = match read_node_hugepage_pools() {
|
||||
Ok(nodes) if numa => {
|
||||
|
||||
Reference in New Issue
Block a user