From 2c5785a8e69313270b052f3b31db86b2e06bbcb3 Mon Sep 17 00:00:00 2001 From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr> Date: Fri, 8 Mar 2019 16:52:33 +0100 Subject: [PATCH] Print the last step --- bin/sasa.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/sasa.ml b/bin/sasa.ml index 915b82c1..8110aa96 100644 --- a/bin/sasa.ml +++ b/bin/sasa.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/03/2019 (at 16:23) by Erwan> *) +(* Time-stamp: <modified the 08/03/2019 (at 16:44) by Erwan Jahier> *) (* XXX Je pourrais utiliser Lwt pour rendre step non-bloquant, ce qui permettrait d'accelerer la simu sur les machines qui ont plusieurs @@ -86,7 +86,10 @@ let rec (simu: int -> int -> Process.t list -> if al <> [] then al::acc else acc) [] pl_n in - if (all = []) then raise (Silent i); + if (all = []) then ( + Printf.eprintf "step %s: %s\n" (string_of_int (n-i+1)) (StringOf.env e pl); + raise (Silent (n-i+1)) + ); let al = Demon.f args.demon all in (* Do the steps *) @@ -103,10 +106,10 @@ let rec (simu: int -> int -> Process.t list -> let al_str = String.concat "," (List.map (fun (p,_,_a) -> Printf.sprintf "%s" p.pid) al) in - Printf.eprintf "step %s: %s (%s)\n" (string_of_int (n-i)) (StringOf.env e pl) al_str; + Printf.eprintf "step %s: %s (%s)\n" (string_of_int (n-i+1)) (StringOf.env e pl) al_str; match all with (* | [_] -> () *) - | [] -> raise (Silent i) + | [] -> assert false | _ -> if i > 0 then simu n (i-1) pl pl_n ne else () let () = -- GitLab