| 1 |
(** TODO: Figure out how to test "sanity" for the ltac profiler output *) |
| 2 |
Fixpoint fact (n : nat) := match n with 0 => 1 | S n' => n * fact n' end. |
| 3 |
Fixpoint walk (n : nat) := match n with 0 => tt | S n => walk n end. |
| 4 |
Ltac slow := idtac + (do 2 (let x := eval lazy in (walk (fact 9)) in idtac)). |
| 5 |
Ltac slow2 := idtac + (do 2 (let x := eval lazy in (walk (fact 9)) in idtac)). |
| 6 |
Ltac multi := idtac + slow + slow2. |
| 7 |
Set Ltac Profiling. |
| 8 |
Goal True. |
| 9 |
Time try (multi; fail). |
| 10 |
(* Warning: Ltac Profiler cannot yet handle backtracking into multi-success |
| 11 |
tactics; profiling results may be wildly inaccurate. |
| 12 |
[profile-backtracking,ltac] *) |
| 13 |
Show Ltac Profile. |
| 14 |
(* Used to be: |
| 15 |
total time: 0.000s |
| 16 |
|
| 17 |
tactic local total calls max |
| 18 |
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘ |
| 19 |
─multi --------------------------------- 47.1% 47.1% 1 0.000s |
| 20 |
─slow ---------------------------------- 35.3% 35.3% 1 0.000s |
| 21 |
─slow2 --------------------------------- 17.6% 17.6% 1 0.000s |
| 22 |
|
| 23 |
tactic local total calls max |
| 24 |
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘ |
| 25 |
─multi --------------------------------- 47.1% 47.1% 1 0.000s |
| 26 |
─slow ---------------------------------- 35.3% 35.3% 1 0.000s |
| 27 |
─slow2 --------------------------------- 17.6% 17.6% 1 0.000s |
| 28 |
|
| 29 |
*) |
| 30 |
(* Now: |
| 31 |
total time: 2.074s |
| 32 |
|
| 33 |
tactic local total calls max |
| 34 |
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘ |
| 35 |
─multi --------------------------------- 0.0% 100.0% 6 1.119s |
| 36 |
─slow ---------------------------------- 54.0% 54.0% 3 1.119s |
| 37 |
─slow2 --------------------------------- 46.0% 46.0% 3 0.955s |
| 38 |
|
| 39 |
tactic local total calls max |
| 40 |
────────────────────────────────────────┴──────┴──────┴───────┴─────────┘ |
| 41 |
─multi --------------------------------- 0.0% 100.0% 6 1.119s |
| 42 |
├─slow -------------------------------- 54.0% 54.0% 3 1.119s |
| 43 |
└─slow2 ------------------------------- 46.0% 46.0% 3 0.955s |
| 44 |
|
| 45 |
*) |
| 46 |
Abort. |