feat: add swap info
This commit is contained in:
11
src/main.zig
11
src/main.zig
@@ -47,6 +47,17 @@ pub fn main() !void {
|
|||||||
try stdout.print("ram: {d:.2} / {d:.2} GB ({}%)\n", .{ ram_info.ram_usage, ram_info.ram_size, ram_info.ram_usage_percentage });
|
try stdout.print("ram: {d:.2} / {d:.2} GB ({}%)\n", .{ ram_info.ram_usage, ram_info.ram_size, ram_info.ram_usage_percentage });
|
||||||
try bw.flush();
|
try bw.flush();
|
||||||
|
|
||||||
|
const swap_result = try os_module.getSwapInfo();
|
||||||
|
switch (swap_result) {
|
||||||
|
.swap_info => |s| {
|
||||||
|
try stdout.print("Swap: {d:.2} / {d:.2} GB ({}%)\n", .{ s.swap_usage, s.swap_size, s.swap_usage_percentage });
|
||||||
|
},
|
||||||
|
.swap_disabled => {
|
||||||
|
try stdout.print("Swap: Disabled\n", .{});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
try bw.flush();
|
||||||
|
|
||||||
const diskInfo = try os_module.getDiskSize("/");
|
const diskInfo = try os_module.getDiskSize("/");
|
||||||
try stdout.print("disk ({s}): {d:.2} / {d:.2} GB ({}%)\n", .{ diskInfo.disk_path, diskInfo.disk_usage, diskInfo.disk_size, diskInfo.disk_usage_percentage });
|
try stdout.print("disk ({s}): {d:.2} / {d:.2} GB ({}%)\n", .{ diskInfo.disk_path, diskInfo.disk_usage, diskInfo.disk_size, diskInfo.disk_usage_percentage });
|
||||||
try bw.flush();
|
try bw.flush();
|
||||||
|
|||||||
Reference in New Issue
Block a user