From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Wed, 17 Oct 2007 13:41:12 +0000 (+0100) Subject: Add the flags for enabling/disabling CPU, block and net stats. X-Git-Tag: 1.0.4~120 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=002d9558cf5986f14c475054b19da31713b7c8b3;p=virt-top.git Add the flags for enabling/disabling CPU, block and net stats. --- diff --git a/virt-top/virt-top.1 b/virt-top/virt-top.1 index d60cc04..91bd7e2 100644 --- a/virt-top/virt-top.1 +++ b/virt-top/virt-top.1 @@ -214,6 +214,15 @@ those to process the \s-1CSV\s0 file). Not every version of virt-top supports \s-1CSV\s0 output \- it depends how the program was compiled (see \fI\s-1README\s0\fR file in the source distribution for details). +.IP "\fB\-\-no\-csv\-cpu\fR" 4 +.IX Item "--no-csv-cpu" +Disable domain \s-1CPU\s0 stats in \s-1CSV\s0 output. +.IP "\fB\-\-no\-csv\-block\fR" 4 +.IX Item "--no-csv-block" +Disable domain block device stats in \s-1CSV\s0 output. +.IP "\fB\-\-no\-csv\-net\fR" 4 +.IX Item "--no-csv-net" +Disable domain network interface stats in \s-1CSV\s0 output. .IP "\fB\-\-debug filename\fR" 4 .IX Item "--debug filename" Send debug and error messages to \fIfilename\fR. @@ -334,6 +343,15 @@ Sets the default filename to use for debug and error messages. .IP "\fBcsv\fR \fIfilename\fR" 4 .IX Item "csv filename" Enables \s-1CSV\s0 output to the named file. +.IP "\fBcsv-cpu\fR \fItrue|false\fR" 4 +.IX Item "csv-cpu true|false" +Enable or disable domain \s-1CPU\s0 stats in \s-1CSV\s0 output. +.IP "\fBcsv-block\fR \fItrue|false\fR" 4 +.IX Item "csv-block true|false" +Enable or disable domain block device stats in \s-1CSV\s0 output. +.IP "\fBcsv-net\fR \fItrue|false\fR" 4 +.IX Item "csv-net true|false" +Enable or disable domain network interface stats in \s-1CSV\s0 output. .IP "\fBbatch\fR \fItrue|false\fR" 4 .IX Item "batch true|false" Sets batch mode. diff --git a/virt-top/virt-top.pod b/virt-top/virt-top.pod index a888d89..9ff956b 100644 --- a/virt-top/virt-top.pod +++ b/virt-top/virt-top.pod @@ -99,6 +99,18 @@ Not every version of virt-top supports CSV output - it depends how the program was compiled (see I file in the source distribution for details). +=item B<--no-csv-cpu> + +Disable domain CPU stats in CSV output. + +=item B<--no-csv-block> + +Disable domain block device stats in CSV output. + +=item B<--no-csv-net> + +Disable domain network interface stats in CSV output. + =item B<--debug filename> Send debug and error messages to I. @@ -254,6 +266,18 @@ Sets the default filename to use for debug and error messages. Enables CSV output to the named file. +=item B I + +Enable or disable domain CPU stats in CSV output. + +=item B I + +Enable or disable domain block device stats in CSV output. + +=item B I + +Enable or disable domain network interface stats in CSV output. + =item B I Sets batch mode. diff --git a/virt-top/virt-top.txt b/virt-top/virt-top.txt index eccd166..85b003f 100644 --- a/virt-top/virt-top.txt +++ b/virt-top/virt-top.txt @@ -72,6 +72,15 @@ OPTIONS the program was compiled (see *README* file in the source distribution for details). + --no-csv-cpu + Disable domain CPU stats in CSV output. + + --no-csv-block + Disable domain block device stats in CSV output. + + --no-csv-net + Disable domain network interface stats in CSV output. + --debug filename Send debug and error messages to *filename*. To send error messages to syslog you can do: @@ -178,6 +187,15 @@ INIT FILE csv *filename* Enables CSV output to the named file. + csv-cpu *true|false* + Enable or disable domain CPU stats in CSV output. + + csv-block *true|false* + Enable or disable domain block device stats in CSV output. + + csv-net *true|false* + Enable or disable domain network interface stats in CSV output. + batch *true|false* Sets batch mode. diff --git a/virt-top/virt_top.ml b/virt-top/virt_top.ml index 5255163..cd1ce64 100644 --- a/virt-top/virt_top.ml +++ b/virt-top/virt_top.ml @@ -102,6 +102,9 @@ let display_mode = ref TaskDisplay let uri = ref None let debug_file = ref "" let csv_enabled = ref false +let csv_cpu = ref true +let csv_block = ref true +let csv_net = ref true let init_file = ref DefaultInitFile let script_mode = ref false @@ -131,6 +134,9 @@ let start_up () = "-c", Arg.String set_uri, "uri Connect to URI (default: Xen)"; "--connect", Arg.String set_uri, "uri Connect to URI (default: Xen)"; "--csv", Arg.String set_csv, "file Log statistics to CSV file"; + "--no-csv-cpu", Arg.Clear csv_cpu, " Disable CPU stats in CSV"; + "--no-csv-block", Arg.Clear csv_block, " Disable block device stats in CSV"; + "--no-csv-net", Arg.Clear csv_net, " Disable net stats in CSV"; "-d", Arg.Float set_delay, "delay Delay time interval (seconds)"; "--debug", Arg.Set_string debug_file, "file Send debug messages to file"; "--hist-cpu", Arg.Set_int historical_cpu_delay, "secs Historical CPU delay"; @@ -163,6 +169,9 @@ OPTIONS" in | _, "connect", uri -> set_uri uri | _, "debug", filename -> debug_file := filename | _, "csv", filename -> set_csv filename + | _, "csv-cpu", b -> csv_cpu := 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 | _, "secure", b -> secure_mode := bool_of_string b | _, "script", b -> script_mode := bool_of_string b @@ -1221,17 +1230,18 @@ let redraw = (* Write CSV header row. *) let write_csv_header () = - (!csv_write) + (!csv_write) ( [ "Hostname"; "Time"; "Arch"; "Physical CPUs"; "Count"; "Running"; "Blocked"; "Paused"; "Shutdown"; "Shutoff"; "Crashed"; "Active"; "Inactive"; "%CPU"; "Total memory (KB)"; "Total guest memory (KB)"; - "Total CPU time (ns)"; + "Total CPU time (ns)" ] @ (* These fields are repeated for each domain: *) - "Domain ID"; "Domain name"; - "CPU (ns)"; "%CPU"; - "Block RDRQ"; "Block WRRQ"; - "Net RXBY"; "Net TXBY" ] + [ "Domain ID"; "Domain name"; ] @ + (if !csv_cpu then [ "CPU (ns)"; "%CPU"; ] else []) @ + (if !csv_block then [ "Block RDRQ"; "Block WRRQ"; ] else []) @ + (if !csv_net then [ "Net RXBY"; "Net TXBY" ] else []) + ) (* Write summary data to CSV file. *) let append_csv @@ -1278,12 +1288,18 @@ let append_csv let domain_fields = List.map ( fun (domname, rd) -> - [ string_of_int rd.rd_domid; domname; - string_of_float rd.rd_cpu_time; string_of_float rd.rd_percent_cpu; - string_of_int64_option rd.rd_block_rd_reqs; - string_of_int64_option rd.rd_block_wr_reqs; - string_of_int64_option rd.rd_net_rx_bytes; - string_of_int64_option rd.rd_net_tx_bytes; ] + [ string_of_int rd.rd_domid; domname ] @ + (if !csv_cpu then [ + string_of_float rd.rd_cpu_time; string_of_float rd.rd_percent_cpu + ] else []) @ + (if !csv_block then [ + string_of_int64_option rd.rd_block_rd_reqs; + string_of_int64_option rd.rd_block_wr_reqs; + ] else []) @ + (if !csv_net then [ + string_of_int64_option rd.rd_net_rx_bytes; + string_of_int64_option rd.rd_net_tx_bytes; + ] else []) ) doms in let domain_fields = List.flatten domain_fields in