This commit is contained in:
Hannes Mehnert 2019-09-19 20:51:18 +02:00
parent b706f4ecf2
commit 8c2dc731de
3 changed files with 11 additions and 3 deletions

View file

@ -21,11 +21,10 @@ depends: [
"tcpip" "tcpip"
"mirage-net-solo5" "mirage-net-solo5"
"mirage-solo5" "mirage-solo5"
"ocaml-freestanding" "ocaml-freestanding" {>= "0.4.5"}
"bheap" "bheap"
] ]
pin-depends: [ pin-depends: [
[ "ocaml-freestanding.dev" "git+https://github.com/hannesm/ocaml-freestanding.git#mallinfo" ]
[ "mirage-solo5.dev" "git+https://github.com/hannesm/mirage-solo5.git#stats" ] [ "mirage-solo5.dev" "git+https://github.com/hannesm/mirage-solo5.git#stats" ]
[ "bheap.dev" "git+https://github.com/hannesm/bheap.git#expose-size" ] [ "bheap.dev" "git+https://github.com/hannesm/bheap.git#expose-size" ]
[ "mirage-net-solo5.dev" "git+https://github.com/hannesm/mirage-net-solo5.git#stats" ] [ "mirage-net-solo5.dev" "git+https://github.com/hannesm/mirage-net-solo5.git#stats" ]

View file

@ -163,6 +163,13 @@ module M = struct
let t = { flows = [] } in let t = { flows = [] } in
Lwt.async (timer_loop get host interval t); Lwt.async (timer_loop get host interval t);
t t
(* actually a pushed *)
let push ?(interval = 10) ?hostname flow =
let get, reporter = R.store_reporter C.elapsed_ns () in
Metrics.set_reporter reporter;
let host = match hostname with None -> [] | Some host -> [vmname host] in
Lwt.async (timer_loop get host interval { flows = [ flow ] })
end end
module S (T : Mirage_time_lwt.S) (P : Mirage_clock.PCLOCK) (C : Mirage_clock.MCLOCK) (S : Mirage_stack_lwt.V4) = struct module S (T : Mirage_time_lwt.S) (P : Mirage_clock.PCLOCK) (C : Mirage_clock.MCLOCK) (S : Mirage_stack_lwt.V4) = struct
@ -204,7 +211,7 @@ jfuLKkCfGcw9A8o=
|} in |} in
match X509.Certificate.decode_pem data with match X509.Certificate.decode_pem data with
| Ok c -> c | Ok c -> c
| Error (`Parse e) -> invalid_arg e | Error (`Msg e) -> invalid_arg e
let create_tls ?(port = 8093) ?hostname ?(interval = 10) s certificates = let create_tls ?(port = 8093) ?hostname ?(interval = 10) s certificates =
Metrics.enable_all (); Metrics.enable_all ();

View file

@ -35,6 +35,8 @@ module M : sig
deregistered. *) deregistered. *)
val add_flow : t -> F.flow -> unit val add_flow : t -> F.flow -> unit
val push : ?interval:int -> ?hostname:string -> F.flow -> unit
end end
module S (T : Mirage_time_lwt.S) (P : Mirage_clock.PCLOCK) (C : Mirage_clock.MCLOCK) (S : Mirage_stack_lwt.V4) : sig module S (T : Mirage_time_lwt.S) (P : Mirage_clock.PCLOCK) (C : Mirage_clock.MCLOCK) (S : Mirage_stack_lwt.V4) : sig