(************************************************************************) (* * The Rocq Prover / The Rocq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************)
(** Ltac profiling primitives *)
(* Note(JasonGross): Ltac semantics are a bit insane. There isn't reallyagoodnotionofhowmanytimesatactichasbeen"called", becausetacticscanbepartiallyevaluated,andit'sunclear whetherthenumberof"calls"shouldbethenumberoftimesthe bodyisfetchedandunfolded,orthenumberoftimesthecodeis executedtoavalue,etc.Thelogicin[Tacinterp.eval_tactic] givesadecentapproximation,whichIbelieveroughlycorresponds tothenumberoftimesthattheenginerunsthetacticvaluewhich resultsfromevaluatingthetacticexpressionboundtothename we'reconsidering.However,thisisapoorapproximationofthe timespentinthetactic;wewanttoconsidertimespentevaluating atacticexpressiontoatacticvaluetobetimespentinthe expression,notjusttimespentinthecalleroftheexpression. Soweneedtowrapsomenodesinadditionalprofilingcallswhich don'tcounttowardstototalcallcount.Whetherornotacall "counts"isindicatedbythe[count_call]booleanargument.
Unfortunately,atpresent,wecangetverystrangecallgraphswhen anamedtacticexpressionneverrunsasatacticvalue:ifwehave [Ltact0:=t.]and[Ltact1:=t0.],then[t1]isconsideredto run0(!)times.Itevaluatesto[t]duringtacticexpression evaluation,andalthoughthecalltracerecordsthefactthatit wascalledby[t0]whichwascalledby[t1],thetacticrunning phaseneverseesthis.Thuswegetonecalltree(fromexpression evaluation)thathas[t1]calls[t0]calls[t],andanothercall treewhichsaysthatthecallerof[t1]calls[t]directly;the expressionevaluationtimegoesinthefirsttree,andthecall countandtacticrunningtimegoesinthesecondtree.Alas,I suspectthatfixingthisrequiresaredesignofhowtheprofiler
hooks into the tactic engine. *) val do_profile_gen :
('a -> Pp.t option) -> 'a ->
?count_call:bool -> 'b Proofview.tactic -> 'b Proofview.tactic
val set_profiling : bool -> unit
val get_profiling : unit -> bool
(* Cut off results < than specified cutoff *) val print_results : cutoff:float option -> unit
val print_results_tactic : string -> unit
val reset_profile : unit -> unit
val restart_timer : stringoption -> unit
val finish_timing : prefix:string -> stringoption -> unit
val do_print_results_at_close : unit -> unit
(* The collected statistics for a tactic. The timing data is collected over all *instancesofagiventacticfromitsparent.E.g.iftactic'aaa'calls *'foo'twice,then'aaa'willcontainjustoneentryfor'foo'withthe *statisticsofthetwoinvocationscombined,andalsocombinedoverall *invocationsof'aaa'. *total:timespentrunningthistacticanditssubtactics(seconds) *local:timespentrunningthistactic,minusitssubtactics(seconds) *ncalls:thenumberofinvocationsofthistacticthathavebeenmade *max_total:thegreatestrunningtimeofasingleinvocation(seconds)
*) type treenode = {
name : string;
total : float;
local : float;
ncalls : int;
max_total : float;
children : treenode CString.Map.t
}
(* Returns the profiling results known by the current process *) val get_local_profiling_results : unit -> treenode val feedback_results : treenode -> unit
val set_get_printing_width : (unit -> int) -> unit (** Internal hook *)
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.