11open Batteries ;
2- module Stats = GoblintCil . Stats ;
32
43let rec make_task_list = tasks =>
54 if (List . is_empty(tasks)) {
65 React . null;
76 } else {
87 <ul >
98 {tasks
10- |> List . mapi((i, task: Stats . t ) => {
9+ |> List . mapi((i, task: Timing . tree ) => {
1110 let key = string_of_int(i);
1211 <li key>
1312 {task. name
1413 ++ ": "
15- ++ string_of_float(task. time )
14+ ++ string_of_float(task. cputime )
1615 ++ " s"
1716 |> React . string}
18- {task. sub |> List . rev |> make_task_list}
17+ {task. children |> List . rev |> make_task_list}
1918 </li >;
2019 })
2120 |> React . list}
@@ -26,16 +25,23 @@ let as_megabytes = words => Printf.sprintf("%.2f MB", words /. 131072.0);
2625
2726[@ react . component ]
2827let make = (~stats) => {
29- let (time : Stats . t , gc : Gc . stat ) = stats;
28+ let (time : Timing . tree , gc : Gc . stat ) = stats;
3029 let total =
31- time. sub |> List . fold_left((acc, sub: Stats . t ) => acc +. sub. time , 0 . 0 );
30+ time. children |> List . fold_left((acc, sub: Timing . tree ) => acc +. sub. cputime , 0 . 0 );
3231
3332 <div >
34- <span >
33+ {if (total == 0 . ) {
34+ <div className= "bg-warning" >
35+ {"For timing statistics the analysis has to be run with -v (alternatively, either option dbg.verbose or dbg.timing.enabled can be activated)" |> React . string}
36+ </div >;
37+ } else {
38+ React . null
39+ }}
40+ <div >
3541 {"Total: " ++ string_of_float(total) ++ " s" |> React . string}
36- </span >
37- {time. sub |> List . rev |> make_task_list}
38- <span >
42+ </div >
43+ {time. children |> List . rev |> make_task_list}
44+ <div >
3945 {Printf . sprintf(
4046 "Memory: total=% s , max=% s , minor=% s , major=% s , promoted=% s , minor collections=% d , major collections=% d , compactions=% d " ,
4147 as_megabytes(gc. minor_words +. gc. major_words -. gc. promoted_words),
@@ -48,6 +54,6 @@ let make = (~stats) => {
4854 gc. compactions,
4955 )
5056 |> React . string}
51- </span >
57+ </div >
5258 </div >;
5359};
0 commit comments