1open Arg 2open Printf 3open Xenlight 4 5let bool_as_char b c = if b then c else '-' 6 7let print_dominfo dominfo = 8 let id = dominfo.Xenlight.Dominfo.domid 9 and running = bool_as_char dominfo.Xenlight.Dominfo.running 'r' 10 and blocked = bool_as_char dominfo.Xenlight.Dominfo.blocked 'b' 11 and paused = bool_as_char dominfo.Xenlight.Dominfo.paused 'p' 12 and shutdown = bool_as_char dominfo.Xenlight.Dominfo.shutdown 's' 13 and dying = bool_as_char dominfo.Xenlight.Dominfo.dying 'd' 14 and memory = dominfo.Xenlight.Dominfo.current_memkb 15 in 16 printf "Dom %d: %c%c%c%c%c %LdKB\n" id running blocked paused shutdown dying memory 17 18let _ = 19 let logger = Xtl.create_stdio_logger (*~level:Xentoollog.Debug*) () in 20 let ctx = Xenlight.ctx_alloc logger in 21 try 22 let domains = Xenlight.Dominfo.list ctx in 23 List.iter (fun d -> print_dominfo d) domains 24 with Xenlight.Error(err, fn) -> begin 25 printf "Caught Exception: %s: %s\n" (Xenlight.string_of_error err) fn; 26 end 27 28 29