X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=blobdiff_plain;f=virt-top%2Fvirt_top.ml;h=9742e60c7bf649a414e84da195350609ed20353e;hp=e2fe55446af226cec64b7cff4fa11ca6a8c3d647;hb=56db27de24772a575d450f0c847ea33ce0f268ff;hpb=cc39f52d6e157d6c3259dafa854d1182692582b3 diff --git a/virt-top/virt_top.ml b/virt-top/virt_top.ml index e2fe554..9742e60 100644 --- a/virt-top/virt_top.ml +++ b/virt-top/virt_top.ml @@ -200,7 +200,8 @@ let start_up () = "-n", Arg.Set_int iterations, "iterations " ^ s_"Number of iterations to run"; "-o", Arg.String set_sort, - "sort " ^ sprintf (f_"Set sort order (%s)") "cpu|mem|time|id|name"; + "sort " ^ sprintf (f_"Set sort order (%s)") + "cpu|mem|time|id|name|netrx|nettx|blockrdrq|blockwrrq"; "-s", Arg.Set secure_mode, " " ^ s_"Secure (\"kiosk\") mode"; "--script", Arg.Set script_mode, @@ -225,6 +226,24 @@ OPTIONS" in (* Read the init file. *) let try_to_read_init_file filename = let config = read_config_file filename in + (* Replacement functions that raise better errors when + * parsing the init file. + *) + let int_of_string s = + try int_of_string s + with Invalid_argument _ -> + failwithf (f_"%s: could not parse '%s' in init file: expecting an integer") + filename s in + let float_of_string s = + try float_of_string s + with Invalid_argument _ -> + failwithf (f_"%s: could not parse '%s' in init file: expecting a number") + filename s in + let bool_of_string s = + try bool_of_string s + with Invalid_argument _ -> + failwithf (f_"%s: could not parse '%s' in init file: expecting %s") + filename s "true|false" in List.iter ( function | _, "display", mode -> display_mode := display_of_cli mode @@ -652,7 +671,7 @@ let collect, clear_pcpu_display_data = (try let domid = rd.rd_domid in let maplen = C.cpumaplen nr_pcpus in - let cpu_stats = D.get_cpu_stats rd.rd_dom nr_pcpus in + let cpu_stats = D.get_cpu_stats rd.rd_dom in let rec find_usages_from_stats = function | ("cpu_time", D.TypedFieldUInt64 usages) :: _ -> usages | _ :: params -> find_usages_from_stats params