Commit 62e4518e authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Added max heap size to the statistics.

parent 20f0ae32
...@@ -15,7 +15,7 @@ make -C $SRC bootstrap || exit 1 ...@@ -15,7 +15,7 @@ make -C $SRC bootstrap || exit 1
# Remove any leftover output files. # Remove any leftover output files.
rm -f log lr.csv rm -f log lr.csv
# Print the header of lr.csv. (This should be kept in sync with LRijkstra.ml.) # Print the header of lr.csv. (This should be kept in sync with LRijkstra.ml.)
echo "grammar,terminals,nonterminals,size,states,trie,facts,edges,time" > lr.csv echo "grammar,terminals,nonterminals,size,states,trie,facts,edges,time,heap" > lr.csv
# Try every grammar. (Only the single-file grammars, that is.) # Try every grammar. (Only the single-file grammars, that is.)
for f in `ls *.mly | egrep -v '.*-([1-9]).mly'` ; do for f in `ls *.mly | egrep -v '.*-([1-9]).mly'` ; do
echo "Now dealing with: $f" | tee -a log echo "Now dealing with: $f" | tee -a log
......
...@@ -1161,20 +1161,25 @@ let _, _ = ...@@ -1161,20 +1161,25 @@ let _, _ =
end end
) )
let max_heap_size =
if X.verbose || X.statistics <> None then
let stat = Gc.quick_stat() in
(stat.Gc.top_heap_words * (Sys.word_size / 8) / 1024 / 1024)
else
0 (* dummy *)
let () = let () =
Time.tick "Forward search"; Time.tick "Forward search";
if X.verbose then begin if X.verbose then begin
Printf.eprintf Printf.eprintf
"%d graph nodes explored by forward search.\n\ "%d graph nodes explored by forward search.\n\
%d out of %d states are reachable.\n\ %d out of %d states are reachable.\n\
Found %d states where an error can occur.\n%!" Found %d states where an error can occur.\n\
Maximum size reached by the major heap: %dM\n%!"
!explored !explored
(Lr1.NodeSet.cardinal !reachable) Lr1.n (Lr1.NodeSet.cardinal !reachable) Lr1.n
(Lr1.NodeMap.cardinal !data); (Lr1.NodeMap.cardinal !data)
let stat = Gc.quick_stat() in max_heap_size
Printf.eprintf
"Maximum size reached by the major heap: %dM\n"
(stat.Gc.top_heap_words * (Sys.word_size / 8) / 1024 / 1024)
end end
(* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *)
...@@ -1188,7 +1193,7 @@ let () = ...@@ -1188,7 +1193,7 @@ let () =
X.statistics |> Option.iter (fun filename -> X.statistics |> Option.iter (fun filename ->
let c = open_out_gen [ Open_creat; Open_append; Open_text ] 0o644 filename in let c = open_out_gen [ Open_creat; Open_append; Open_text ] 0o644 filename in
Printf.fprintf c Printf.fprintf c
"%s,%d,%d,%d,%d,%d,%d,%d,%.2f\n%!" "%s,%d,%d,%d,%d,%d,%d,%d,%.2f,%d\n%!"
(* Grammar name. *) (* Grammar name. *)
Settings.base Settings.base
(* Number of terminal symbols. *) (* Number of terminal symbols. *)
...@@ -1215,6 +1220,8 @@ let () = ...@@ -1215,6 +1220,8 @@ let () =
(E.size()) (E.size())
(* Elapsed user time, in seconds. *) (* Elapsed user time, in seconds. *)
(stop -. start) (stop -. start)
(* Max heap size, in megabytes. *)
max_heap_size
; ;
close_out c close_out c
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment