From 36c2a8255695b5c65d95cb4e9e8aa0cb5d074af0 Mon Sep 17 00:00:00 2001 From: Pascal Brisset Date: Mon, 8 Sep 2008 12:03:16 +0000 Subject: [PATCH] Trafic stats on stdout --- sw/ground_segment/tmtc/link.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sw/ground_segment/tmtc/link.ml b/sw/ground_segment/tmtc/link.ml index 2fc42a6bda..ffd67d4832 100644 --- a/sw/ground_segment/tmtc/link.ml +++ b/sw/ground_segment/tmtc/link.ml @@ -59,6 +59,9 @@ let my_id = 0 (* enable broadcast messages by default *) let ac_info = ref true +(* Enable trafic statistics on standard output *) +let gen_stat_trafic = ref false + let ios = int_of_string let (//) = Filename.concat let conf_dir = Env.paparazzi_home // "conf" @@ -89,6 +92,8 @@ type status = { let statuss = Hashtbl.create 3 let dead_aircraft_time_ms = 5000 let update_status = fun ac_id buf_size is_pong -> + if !gen_stat_trafic then + Printf.printf "%.3f %d\n%!" (Unix.gettimeofday ()) buf_size; let status = try Hashtbl.find statuss ac_id with Not_found -> let s = { last_rx_byte = 0; last_rx_msg = 0; rx_byte = 0; rx_msg = 0; rx_err = 0; ms_since_last_msg = dead_aircraft_time_ms; last_ping = 0.; last_pong = 0. } in @@ -402,6 +407,7 @@ let () = let options = [ "-b", Arg.Set_string ivy_bus, (sprintf " Default is %s" !ivy_bus); "-d", Arg.Set_string port, (sprintf " Default is %s" !port); + "-fg", Arg.Set gen_stat_trafic, "Enable trafic statistics on standard output"; "-xbee_addr", Arg.Set_int XB.my_addr, (sprintf " (%d)" !XB.my_addr); "-xbee_retries", Arg.Set_int XB.my_addr, (sprintf " (%d)" !XB.nb_retries); "-transport", Arg.Set_string transport, (sprintf " Available protocols are modem,pprz and xbee. Default is %s" !transport);