diff options
| -rw-r--r-- | lib/profile.ml | 7 | ||||
| -rw-r--r-- | toplevel/coqtop.ml | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/profile.ml b/lib/profile.ml index 78bf35621a..0bc226a450 100644 --- a/lib/profile.ml +++ b/lib/profile.ml @@ -85,6 +85,9 @@ let init_alloc = ref 0.0 let reset_profile () = List.iter reset_record !prof_table let init_profile () = + (* We test Flags.profile as a way to support declaring profiled + functions in plugins *) + if !prof_table <> [] || Flags.profile then begin let outside = create_record () in stack := [outside]; last_alloc := get_alloc (); @@ -92,6 +95,7 @@ let init_profile () = init_time := get_time (); outside.tottime <- - !init_time; outside.owntime <- - !init_time + end let ajoute n o = o.owntime <- o.owntime + n.owntime; @@ -358,9 +362,6 @@ let declare_profile name = prof_table := (name,e)::!prof_table; e -(* Default initialization, may be overridden *) -let _ = init_profile () - (******************************) (* Entry points for profiling *) let profile1 e f a = diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml index 08c2350237..d79257b5c2 100644 --- a/toplevel/coqtop.ml +++ b/toplevel/coqtop.ml @@ -613,6 +613,7 @@ let parse_args arglist = with any -> fatal_error any let init_toplevel arglist = + Profile.init_profile (); init_gc (); Sys.catch_break false; (* Ctrl-C is fatal during the initialisation *) let init_feeder = Feedback.add_feeder coqtop_init_feed in |
