123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(* This file is free software, part of dolmen. See file "LICENSE" for more information *)(* Global things *)(* ************************************************************************* *)letenabled=reffalseletwrap_at_exitprintt=at_exit(fun()->if!enabledthenFormat.printf"%a@."printt);t(* One-value statistics *)(* ************************************************************************* *)moduleFloat=structtypet={name:string;mutablevalue:float;}letprintfmtt=Format.fprintffmt"* %s: @[<hov>%f@]"t.namet.valueletcreatename=wrap_at_exitprint{name;value=nan;}letsettv=t.value<-vend(* Cumulative statistics *)(* ************************************************************************* *)moduleFloats=structtypet={name:string;mutablecount:int;mutabletotal_time:float;}letprintfmtt=Format.fprintffmt"* @[<v>%s@;\
+ count: %d@;\
+ total: %f@;\
+ mean : %f@]"t.namet.countt.total_time(t.total_time/.floatt.count)letcreatename=wrap_at_exitprint{name;count=0;total_time=0.;}letaddttime=t.total_time<-t.total_time+.time;t.count<-t.count+1;()end