in below/dump/src/test.rs [87:187]
fn test_dump_sys_titles() {
let titles = expand_fields(command::DEFAULT_SYSTEM_FIELDS, true)
.into_iter()
.chain(
model::SingleCpuModelFieldId::unit_variant_iter().map(|subquery_id| {
DumpField::FieldId(model::SystemModelFieldId::Cpus(model::VecFieldId {
idx: Some(31),
subquery_id,
}))
}),
)
.filter_map(|dump_field| match dump_field {
DumpField::Common(_) => None,
DumpField::FieldId(field_id) => {
let rc = model::SystemModel::get_render_config_for_dump(&field_id);
Some(rc.render_title(false))
}
})
.collect::<Vec<_>>();
let expected_titles = vec![
"Hostname",
"Usage",
"User",
"System",
"Idle",
"Nice",
"IOWait",
"Irq",
"SoftIrq",
"Stolen",
"Guest",
"Guest Nice",
"Total",
"Free",
"Available",
"Buffers",
"Cached",
"Swap Cached",
"Active",
"Inactive",
"Anon",
"File",
"Unevictable",
"Mlocked",
"Swap Total",
"Swap Free",
"Dirty",
"Writeback",
"Anon Pages",
"Mapped",
"Shmem",
"Kreclaimable",
"Slab",
"Slab Reclaimable",
"Slab Unreclaimable",
"Kernel Stack",
"Page Tables",
"Anon Huge Pages",
"Shmem Huge Pages",
"File Huge Pages",
"Hugetlb",
"Cma Total",
"Cma Free",
"Vmalloc Total",
"Vmalloc Used",
"Vmalloc Chunk",
"Direct Map 4K",
"Direct Map 2M",
"Direct Map 1G",
"Page In",
"Page Out",
"Swap In",
"Swap Out",
"Pgsteal Kswapd",
"Pgsteal Direct",
"Pgscan Kswapd",
"Pgscan Direct",
"OOM Kills",
"Kernel Version",
"OS Release",
"Total Interrupts",
"Context Switches",
"Boot Time Epoch",
"Total Procs",
"Running Procs",
"Blocked Procs",
"CPU 31 Idx",
"CPU 31 Usage",
"CPU 31 User",
"CPU 31 System",
"CPU 31 Idle",
"CPU 31 Nice",
"CPU 31 IOWait",
"CPU 31 Irq",
"CPU 31 SoftIrq",
"CPU 31 Stolen",
"CPU 31 Guest",
"CPU 31 Guest Nice",
];
assert_eq!(titles, expected_titles);
}