src/Tools/profiling.ML
author wenzelm
Mon, 24 Jul 2023 16:11:16 +0200
changeset 78449 dfe60f5594bd
parent 78328 007b04dc6f96
child 78450 14219730e04f
permissions -rw-r--r--
proper base_thys;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
78315
addecc8de2c4 proper system integration and renaming;
wenzelm
parents: 78314
diff changeset
     1
(*  Title:      Tools/profiling.ML
addecc8de2c4 proper system integration and renaming;
wenzelm
parents: 78314
diff changeset
     2
    Author:     Makarius
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
     3
78315
addecc8de2c4 proper system integration and renaming;
wenzelm
parents: 78314
diff changeset
     4
Session profiling based on loaded ML image.
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
     5
*)
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
     6
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
     7
signature PROFILING =
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
     8
sig
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
     9
  val locales: theory -> string list
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    10
  val locale_thms: theory -> string -> thm list
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    11
  val locales_thms: theory -> thm list
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    12
  val global_thms: theory -> thm list
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    13
  val all_thms: theory -> thm list
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    14
  type session_statistics =
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    15
   {theories: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    16
    locales: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    17
    locale_thms: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    18
    global_thms: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    19
    sizeof_thys_id: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    20
    sizeof_thms_id: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    21
    sizeof_terms: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    22
    sizeof_types: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    23
    sizeof_spaces: int}
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    24
  val session_statistics: string list -> session_statistics
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    25
  val main: unit -> unit
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    26
end;
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    27
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    28
structure Profiling: PROFILING =
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    29
struct
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    30
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    31
(* theory content *)
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    32
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    33
fun locales thy =
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    34
  let
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    35
    val parent_spaces = map Locale.locale_space (Theory.parents_of thy);
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    36
    fun add name =
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    37
      if exists (fn space => Name_Space.declared space name) parent_spaces then I
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    38
      else cons name;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    39
  in fold add (Locale.get_locales thy) [] end;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    40
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    41
fun proper_thm thm = not (Thm.eq_thm_prop (Drule.dummy_thm, thm));
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    42
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    43
fun locale_thms thy loc =
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    44
  (Locale.locale_notes thy loc, []) |->
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    45
    (fold (#2 #> fold (#2 #> (fold (#1 #> fold (fn thm => proper_thm thm ? cons thm ))))));
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    46
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    47
fun locales_thms thy =
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    48
  maps (locale_thms thy) (locales thy);
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    49
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    50
fun global_thms thy =
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    51
  Facts.dest_static true
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    52
    (map Global_Theory.facts_of (Theory.parents_of thy)) (Global_Theory.facts_of thy)
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    53
  |> maps #2;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    54
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    55
fun all_thms thy = locales_thms thy @ global_thms thy;
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    56
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    57
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    58
(* session content *)
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    59
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    60
fun session_content thys =
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    61
  let
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    62
    val thms = maps all_thms thys;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    63
    val thys_id = map Context.theory_id thys;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    64
    val thms_id = map Thm.theory_id thms;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    65
    val terms = (fold o Thm.fold_terms {hyps = true}) cons thms [];
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    66
    val types = (fold o fold_types) cons terms [];
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    67
    val spaces =
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    68
      maps (fn f => map f thys)
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    69
       [Sign.class_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    70
        Sign.type_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    71
        Sign.const_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    72
        Theory.axiom_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    73
        Thm.oracle_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    74
        Global_Theory.fact_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    75
        Locale.locale_space,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    76
        Attrib.attribute_space o Context.Theory,
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    77
        Method.method_space o Context.Theory];
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    78
  in {thys_id = thys_id, thms_id = thms_id, terms = terms, types = types, spaces = spaces} end;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    79
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    80
fun sizeof_diff (a, b) = ML_Heap.sizeof a - ML_Heap.sizeof b;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    81
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    82
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    83
(* session statistics *)
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    84
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    85
type session_statistics =
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    86
 {theories: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    87
  locales: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    88
  locale_thms: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    89
  global_thms: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    90
  sizeof_thys_id: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    91
  sizeof_thms_id: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    92
  sizeof_terms: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    93
  sizeof_types: int,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    94
  sizeof_spaces: int};
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    95
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
    96
fun session_statistics theories : session_statistics =
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    97
  let
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    98
    val theories_member = Symtab.defined (Symtab.make_set theories) o Context.theory_long_name;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
    99
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   100
    val context_thys =
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   101
      #contexts (Context.finish_tracing ())
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   102
      |> map_filter (fn (Context.Theory thy, _) => SOME thy | _ => NONE);
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   103
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   104
    val loader_thys = map Thy_Info.get_theory (Thy_Info.get_names ());
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   105
    val loaded_thys = filter theories_member loader_thys;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   106
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   107
    val all_thys = loader_thys @ context_thys;
78449
dfe60f5594bd proper base_thys;
wenzelm
parents: 78328
diff changeset
   108
    val base_thys = filter_out theories_member all_thys;
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   109
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   110
    val {thys_id = all_thys_id, thms_id = all_thms_id, terms = all_terms,
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   111
          types = all_types, spaces = all_spaces} = session_content all_thys;
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   112
    val {thys_id = base_thys_id, thms_id = base_thms_id, terms = base_terms,
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   113
          types = base_types, spaces = base_spaces} = session_content base_thys;
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   114
  in
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   115
    {theories = length loaded_thys,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   116
     locales = Integer.sum (map (length o locales) loaded_thys),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   117
     locale_thms = Integer.sum (map (length o locales_thms) loaded_thys),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   118
     global_thms = Integer.sum (map (length o global_thms) loaded_thys),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   119
     sizeof_thys_id = sizeof_diff (all_thys_id, base_thys_id),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   120
     sizeof_thms_id = sizeof_diff (all_thms_id, base_thms_id),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   121
     sizeof_terms = sizeof_diff (all_terms, base_terms),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   122
     sizeof_types = sizeof_diff (all_types, base_types),
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   123
     sizeof_spaces = sizeof_diff (all_spaces, base_spaces)}
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   124
  end;
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   125
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   126
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   127
(* main entry point for external process *)
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   128
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   129
local
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   130
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   131
val decode_args : string list XML.Decode.T =
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   132
  let open XML.Decode in list string end;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   133
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   134
val encode_result : session_statistics XML.Encode.T =
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   135
  (fn {theories = a,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   136
       locales = b,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   137
       locale_thms = c,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   138
       global_thms = d,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   139
       sizeof_thys_id = e,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   140
       sizeof_thms_id = f,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   141
       sizeof_terms = g,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   142
       sizeof_types = h,
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   143
       sizeof_spaces = i} => (a, (b, (c, (d, (e, (f, (g, (h, i))))))))) #>
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   144
  let open XML.Encode
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   145
  in pair int (pair int (pair int (pair int (pair int (pair int (pair int (pair int int))))))) end;
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   146
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   147
in
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   148
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   149
fun main () =
78315
addecc8de2c4 proper system integration and renaming;
wenzelm
parents: 78314
diff changeset
   150
  (case getenv "ISABELLE_PROFILING" of
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   151
    "" => ()
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   152
  | dir_name =>
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   153
      let
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   154
        val dir = Path.explode dir_name;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   155
        val args = decode_args (YXML.parse_body (File.read (dir + \<^path>\<open>args.yxml\<close>)));
78328
007b04dc6f96 clarified session_statistics: removed somewhat pointless per-theory statistics;
wenzelm
parents: 78315
diff changeset
   156
        val result = session_statistics args;
78314
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   157
      in File.write (dir + \<^path>\<open>result.yxml\<close>) (YXML.string_of_body (encode_result result)) end);
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   158
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   159
end;
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   160
1588bec693c2 copy/rename files from private autocorres version e45b9b680d3e;
wenzelm
parents:
diff changeset
   161
end;