Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file stats.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287(**************************************************************************)(* This file is part of BINSEC. *)(* *)(* Copyright (C) 2016-2023 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)typetime={mutablesec:float}moduleExploration():Types.EXPLORATION_STATISTICS_FULL=structletpaths=ref1letcounter=lethalt=ref0andcut=ref0andunsatisfiable_assumption=ref0andassertion_failed=ref0andmax_depth=ref0andenumeration_limit=ref0andunresolved_formula=ref0andnon_executable_code=ref0anddie=ref0infun(status:Types.status)->matchstatuswith|Halt->halt|Cut->cut|Unsatisfiable_assumption->unsatisfiable_assumption|Assertion_failed->assertion_failed|Max_depth->max_depth|Enumeration_limit->enumeration_limit|Unresolved_formula->unresolved_formula|Non_executable_code->non_executable_code|Die->dieletcompleted_paths=ref0letunknown_paths=ref0lettotal_asserts=ref0letfailed_asserts=ref0letbranches=ref0letmax_depth=ref0letinstructions=ref0letunique_insts=Virtual_address.Htbl.create256letinit_time={sec=Unix.gettimeofday()}letreset()=paths:=1;completed_paths:=0;unknown_paths:=0;total_asserts:=0;failed_asserts:=0;branches:=0;max_depth:=0;instructions:=0;Virtual_address.Htbl.clearunique_insts;init_time.sec<-Unix.gettimeofday()lettime()=Unix.gettimeofday()-.init_time.secletget_time=timeletget_paths()=!pathsletget_pending_paths()=!paths-!completed_paths-!unknown_pathsletget_completed_paths()=!completed_pathsletget_unknown_paths()=!unknown_pathsletget_statusstatus=!(counterstatus)letget_total_asserts()=!total_assertsletget_failed_asserts()=!failed_assertsletget_branches()=!branchesletget_max_depth()=!max_depthletget_instructions()=!instructionsletget_unique_insts()=Virtual_address.Htbl.lengthunique_instsletadd_path()=incrpathsletterminate_path(status:Types.status)=incr(counterstatus);matchstatuswith|Halt|Cut|Assertion_failed|Unsatisfiable_assumption->incrcompleted_paths|Max_depth|Enumeration_limit|Unresolved_formula|Non_executable_code|Die->incrunknown_pathsletadd_assert()=incrtotal_assertsletadd_failed_assert()=incrfailed_assertsletadd_branch()=incrbranchesletupdate_depthd=if!max_depth<dthenmax_depth:=dletadd_instructionsn=instructions:=!instructions+nletregister_addressaddr=Virtual_address.Htbl.replaceunique_instsaddr()letppppf()=Format.fprintfppf"@[<v 0>@[<h>total paths %d@]@,\
@[<h>completed/cut paths %d@]@,\
@[<h>pending paths %d@]@,\
@[<h>stale paths %d@]@,\
@[<h>failed assertions %d@]@,\
@[<h>branching points %d@]@,\
@[<h>max path depth %d@]@,\
@[<h>visited instructions (unrolled) %d@]@,\
@[<h>visited instructions (static) %d@]@,\
@]"!paths!completed_paths(!paths-!completed_paths-!unknown_paths)!unknown_paths!failed_asserts!branches!max_depth!instructions(Virtual_address.Htbl.lengthunique_insts)letto_toml()=Toml.Min.of_key_values[(Toml.Min.key"paths",Toml.Types.TInt!paths);(Toml.Min.key"completed_paths",Toml.Types.TInt!completed_paths);(Toml.Min.key"unknown_paths",Toml.Types.TInt!unknown_paths);(Toml.Min.key"total_asserts",Toml.Types.TInt!total_asserts);(Toml.Min.key"failed_asserts",Toml.Types.TInt!failed_asserts);(Toml.Min.key"branches",Toml.Types.TInt!branches);(Toml.Min.key"max_depth",Toml.Types.TInt!max_depth);(Toml.Min.key"instructions",Toml.Types.TInt!instructions);(Toml.Min.key"unique_insts",Toml.Types.TInt(Virtual_address.Htbl.lengthunique_insts));]endmoduleQuery():Types.QUERY_STATISTICS=structmodulePreprocess=structletsat=ref0letunsat=ref0letconst=ref0letget_sat()=!satletget_unsat()=!unsatletget_const()=!constlettotal()=!sat+!unsat+!constletincr_sat()=incrsatletincr_unsat()=incrunsatletincr_const()=incrconstletreset()=sat:=0;unsat:=0;const:=0letppppf()=letopenFormatinfprintfppf"@[<v 2>@[<h>Preprocessing simplifications@]@,\
@[<h>total %d@]@,\
@[<h>sat %d@]@,\
@[<h>unsat %d@]@,\
@[<h>constant enum %d@]@]"(total())!sat!unsat!constletto_toml()=Toml.Min.of_key_values[(Toml.Min.key"sat",Toml.Types.TInt!sat);(Toml.Min.key"unsat",Toml.Types.TInt!unsat);(Toml.Min.key"const",Toml.Types.TInt!const);]endmoduleSolver=structletsat=ref0letunsat=ref0leterr=ref0letget_sat()=!satletget_unsat()=!unsatletget_err()=!errletincr_sat()=incrsatletincr_unsat()=incrunsatletincr_err()=increrrlettotal_time={sec=0.}lettimer={sec=0.}letrunning=reffalseletreset()=sat:=0;unsat:=0;err:=0;total_time.sec<-0.;running:=falseletstart_timer()=timer.sec<-Unix.gettimeofday();running:=trueletstop_timer()=running:=false;letelapsed=Unix.gettimeofday()-.timer.secintotal_time.sec<-total_time.sec+.elapsedlettotal()=!sat+!unsat+!errlettotal_time()=if!runningthenletelapsed=Unix.gettimeofday()-.timer.secintotal_time.sec+.elapsedelsetotal_time.secletget_time=total_timeletppppf()=letopenFormatinlettime=total_time()andqueries=total()infprintfppf"@[<v 2>@[<h>Satisfiability queries@]@,\
@[<h>total %d@]@,\
@[<h>sat %d@]@,\
@[<h>unsat %d@]@,\
@[<h>unknown %d@]@,\
@[<h>time %.2f@]@,\
@[<h>average %.2f@]@]"(total())!sat!unsat!errtime(time/.floatqueries)letto_toml()=Toml.Min.of_key_values[(Toml.Min.key"sat",Toml.Types.TInt!sat);(Toml.Min.key"unsat",Toml.Types.TInt!unsat);(Toml.Min.key"err",Toml.Types.TInt!err);(Toml.Min.key"time",Toml.Types.TFloat(total_time()));]endletreset()=Preprocess.reset();Solver.reset()letppppf()=letopenFormatinfprintfppf"@[<v 0>%a@,@,%a@,@]"Preprocess.pp()Solver.pp()end