X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=blobdiff_plain;f=virt-top%2Fvirt_top.ml;h=ef5ac6753de13d9f688c71a4682062e31695c6bb;hp=3c6f47d3d6ae54149c5799e5133399387b65c527;hb=20afbd9ba7055428a8ddfc13bba2e357836b461b;hpb=756b7b3faccdab8234b9f11126b147121532a24c diff --git a/virt-top/virt_top.ml b/virt-top/virt_top.ml index 3c6f47d..ef5ac67 100644 --- a/virt-top/virt_top.ml +++ b/virt-top/virt_top.ml @@ -126,6 +126,7 @@ let uri = ref None let debug_file = ref "" let csv_enabled = ref false let csv_cpu = ref true +let csv_mem = ref true let csv_block = ref true let csv_net = ref true let init_file = ref DefaultInitFile @@ -171,13 +172,15 @@ let start_up () = "-b", Arg.Set batch_mode, " " ^ s_"Batch mode"; "-c", Arg.String set_uri, - "uri " ^ s_"Connect to URI (default: Xen)"; + "uri " ^ s_"Connect to libvirt URI"; "--connect", Arg.String set_uri, - "uri " ^ s_"Connect to URI (default: Xen)"; + "uri " ^ s_"Connect to libvirt URI"; "--csv", Arg.String set_csv, "file " ^ s_"Log statistics to CSV file"; "--no-csv-cpu", Arg.Clear csv_cpu, " " ^ s_"Disable CPU stats in CSV"; + "--no-csv-mem", Arg.Clear csv_mem, + " " ^ s_"Disable memory stats in CSV"; "--no-csv-block", Arg.Clear csv_block, " " ^ s_"Disable block device stats in CSV"; "--no-csv-net", Arg.Clear csv_net, @@ -233,6 +236,7 @@ OPTIONS" in | _, "debug", filename -> debug_file := filename | _, "csv", filename -> set_csv filename | _, "csv-cpu", b -> csv_cpu := bool_of_string b + | _, "csv-mem", b -> csv_mem := bool_of_string b | _, "csv-block", b -> csv_block := bool_of_string b | _, "csv-net", b -> csv_net := bool_of_string b | _, "batch", b -> batch_mode := bool_of_string b @@ -268,7 +272,7 @@ OPTIONS" in prerr_endline (Libvirt.Virterror.to_string err); (* If non-root and no explicit connection URI, print a warning. *) if Unix.geteuid () <> 0 && name = None then ( - print_endline (s_"NB: If you want to monitor a local Xen hypervisor, you usually need to be root"); + print_endline (s_"NB: If you want to monitor a local hypervisor, you usually need to be root"); ); exit 1 in @@ -1238,6 +1242,7 @@ let write_csv_header () = (* These fields are repeated for each domain: *) [ "Domain ID"; "Domain name"; ] @ (if !csv_cpu then [ "CPU (ns)"; "%CPU"; ] else []) @ + (if !csv_mem then [ "Mem (bytes)"; "%Mem";] else []) @ (if !csv_block && not !block_in_bytes then [ "Block RDRQ"; "Block WRRQ"; ] else []) @ (if !csv_block && !block_in_bytes @@ -1295,6 +1300,9 @@ let append_csv (if !csv_cpu then [ string_of_float rd.rd_cpu_time; string_of_float rd.rd_percent_cpu ] else []) @ + (if !csv_mem then [ + Int64.to_string rd.rd_mem_bytes; Int64.to_string rd.rd_mem_percent + ] else []) @ (if !csv_block then [ string_of_int64_option rd.rd_block_rd_info; string_of_int64_option rd.rd_block_wr_info;