]> matita.cs.unibo.it Git - helm.git/blob - helm/software/helena/src/common/output.ml
2af0b535bb1f9e07bcbea5c3e1a7d63be445dd52
[helm.git] / helm / software / helena / src / 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 module G = Options
15
16 type reductions = {
17    beta   : int;
18    zeta   : int;
19    theta  : int;
20    epsilon: int;
21    ldelta : int;
22    gdelta : int;
23    si     : int;
24    lrt    : int;
25    grt    : int;
26    e      : int;
27 }
28
29 let initial_reductions = {
30    beta = 0; theta = 0; epsilon = 0; zeta = 0; ldelta = 0; gdelta = 0;
31    si = 0; lrt = 0; grt = 0; e = 0;
32 }
33
34 let reductions = ref initial_reductions
35
36 let clear_reductions () = reductions := initial_reductions
37
38 let add 
39    ?(beta=0) ?(theta=0) ?(epsilon=0) ?(ldelta=0) ?(gdelta=0) ?(zeta=0) 
40    ?(si=0) ?(lrt=0) ?(grt=0) ?(e=0) ()
41 = reductions := {
42    beta = !reductions.beta + beta;
43    zeta = !reductions.zeta + zeta;
44    theta = !reductions.theta + theta;
45    epsilon = !reductions.epsilon + epsilon;
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    e = !reductions.e + e;
52 }
53
54 let print_reductions () =
55    let r = !reductions in
56    let rs = r.beta + r.ldelta + r.zeta + r.theta + r.epsilon + r.gdelta in
57    let prs = r.si + r.lrt + r.grt + r.e in
58    let delta = r.ldelta + r.gdelta in
59    let rt = r.lrt + r.grt in   
60    L.warn (P.sprintf "  Reductions summary");
61    L.warn (P.sprintf "    Proper reductions:        %7u" rs);
62    L.warn (P.sprintf "      Beta:                   %7u" r.beta);
63    L.warn (P.sprintf "      Delta:                  %7u" delta);
64    L.warn (P.sprintf "        Local:                %7u" r.ldelta);
65    L.warn (P.sprintf "        Global:               %7u" r.gdelta);
66    L.warn (P.sprintf "      Theta:                  %7u" r.theta);
67    L.warn (P.sprintf "      Zeta for abbreviation:  %7u" r.zeta);
68    L.warn (P.sprintf "      Zeta for cast:          %7u" r.epsilon);
69    L.warn (P.sprintf "    Pseudo reductions:        %7u" prs);
70    L.warn (P.sprintf "      Reference typing:       %7u" rt);
71    L.warn (P.sprintf "        Local:                %7u" r.lrt);
72    L.warn (P.sprintf "        Global:               %7u" r.grt);
73    L.warn (P.sprintf "      Cast typing:            %7u" r.e);  
74    L.warn (P.sprintf "      Sort inclusion:         %7u" r.si);
75    L.warn (P.sprintf "  Relocated nodes (icm):      %7u" !G.icm)