]> matita.cs.unibo.it Git - helm.git/blob - helm/software/lambda-delta/common/output.ml
Additional contribs.
[helm.git] / helm / software / lambda-delta / common / output.ml
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic        
3     ||A||  Library of Mathematics, developed at the Computer Science     
4     ||T||  Department, University of Bologna, Italy.                     
5     ||I||                                                                
6     ||T||  HELM is free software; you can redistribute it and/or         
7     ||A||  modify it under the terms of the GNU General Public License   
8     \   /  version 2 or (at your option) any later version.              
9      \ /   This software is distributed as is, NO WARRANTY.              
10       V_______________________________________________________________ *)
11
12 module P = Printf
13 module L = Log
14
15 let icm = ref 0
16
17 type reductions = {
18    beta   : int;
19    zeta   : int;
20    upsilon: int;
21    tau    : int;
22    ldelta : int;
23    gdelta : int;
24    si     : int;
25    lrt    : int;
26    grt    : int
27 }
28
29 let initial_reductions = {
30    beta = 0; upsilon = 0; tau = 0; zeta = 0; ldelta = 0; gdelta = 0;
31    si = 0; lrt = 0; grt = 0
32 }
33
34 let reductions = ref initial_reductions
35
36 let clear_reductions () = reductions := initial_reductions
37
38 let add 
39    ?(beta=0) ?(upsilon=0) ?(tau=0) ?(ldelta=0) ?(gdelta=0) ?(zeta=0) 
40    ?(si=0) ?(lrt=0) ?(grt=0) ()
41 = reductions := {
42    beta = !reductions.beta + beta;
43    zeta = !reductions.zeta + zeta;
44    upsilon = !reductions.upsilon + upsilon;
45    tau = !reductions.tau + tau;
46    ldelta = !reductions.ldelta + ldelta;
47    gdelta = !reductions.gdelta + gdelta;
48    si = !reductions.si + si;
49    lrt = !reductions.lrt + lrt;
50    grt = !reductions.grt + grt
51 }
52
53 let print_reductions () =
54    let r = !reductions in
55    let rs = r.beta + r.ldelta + r.zeta + r.upsilon + r.tau + r.gdelta in
56    let prs = r.si + r.lrt + r.grt in
57    let delta = r.ldelta + r.gdelta in
58    let rt = r.lrt + r.grt in   
59    L.warn (P.sprintf "  Reductions summary");
60    L.warn (P.sprintf "    Proper reductions:        %7u" rs);
61    L.warn (P.sprintf "      Beta:                   %7u" r.beta);
62    L.warn (P.sprintf "      Delta:                  %7u" delta);
63    L.warn (P.sprintf "        Local:                %7u" r.ldelta);
64    L.warn (P.sprintf "        Global:               %7u" r.gdelta);
65    L.warn (P.sprintf "      Zeta:                   %7u" r.zeta);
66    L.warn (P.sprintf "      Upsilon:                %7u" r.upsilon);
67    L.warn (P.sprintf "      Tau:                    %7u" r.tau);
68    L.warn (P.sprintf "    Pseudo reductions:        %7u" prs);
69    L.warn (P.sprintf "      Reference typing:       %7u" rt);
70    L.warn (P.sprintf "        Local:                %7u" r.lrt);
71    L.warn (P.sprintf "        Global:               %7u" r.grt);
72    L.warn (P.sprintf "      Sort inclusion:         %7u" r.si);
73    L.warn (P.sprintf "  Relocated nodes (icm):      %7u" !icm)
74
75 let indexes = ref false