src/Pure/Tools/build.ML
changeset 71622 ab5009192ebb
parent 71619 e33f6e5f86b6
child 71631 3f02bc5a5a03
equal deleted inserted replaced
71621:281591ab169b 71622:ab5009192ebb
    56     val factor = Time.toReal (#cpu timing) / Time.toReal (#elapsed timing)
    56     val factor = Time.toReal (#cpu timing) / Time.toReal (#elapsed timing)
    57       |> Real.fmt (StringCvt.FIX (SOME 2));
    57       |> Real.fmt (StringCvt.FIX (SOME 2));
    58 
    58 
    59     val timing_props =
    59     val timing_props =
    60       [("threads", threads)] @ Markup.timing_properties timing @ [("factor", factor)];
    60       [("threads", threads)] @ Markup.timing_properties timing @ [("factor", factor)];
    61     val _ = Protocol_Message.inline_properties "Timing" timing_props;
    61     val _ = Protocol_Message.marker "Timing" timing_props;
    62     val _ =
    62     val _ =
    63       if verbose then
    63       if verbose then
    64         Output.physical_stderr ("Timing " ^ name ^ " (" ^
    64         Output.physical_stderr ("Timing " ^ name ^ " (" ^
    65           threads ^ " threads, " ^ Timing.message timing ^ ", factor " ^ factor ^ ")\n")
    65           threads ^ " threads, " ^ Timing.message timing ^ ", factor " ^ factor ^ ")\n")
    66       else ();
    66       else ();
    71 
    71 
    72 fun protocol_message props output =
    72 fun protocol_message props output =
    73   (case props of
    73   (case props of
    74     function :: args =>
    74     function :: args =>
    75       if function = Markup.ML_statistics orelse function = Markup.task_statistics then
    75       if function = Markup.ML_statistics orelse function = Markup.task_statistics then
    76         Protocol_Message.inline_properties (#2 function) args
    76         Protocol_Message.marker (#2 function) args
    77       else if function = Markup.command_timing then
    77       else if function = Markup.command_timing then
    78         let
    78         let
    79           val name = the_default "" (Properties.get args Markup.nameN);
    79           val name = the_default "" (Properties.get args Markup.nameN);
    80           val pos = Position.of_properties args;
    80           val pos = Position.of_properties args;
    81           val {elapsed, ...} = Markup.parse_timing_properties args;
    81           val {elapsed, ...} = Markup.parse_timing_properties args;
    84             elapsed >= Options.default_seconds "command_timing_threshold";
    84             elapsed >= Options.default_seconds "command_timing_threshold";
    85         in
    85         in
    86           if is_significant then
    86           if is_significant then
    87             (case approximative_id name pos of
    87             (case approximative_id name pos of
    88               SOME id =>
    88               SOME id =>
    89                 Protocol_Message.inline_properties (#2 function)
    89                 Protocol_Message.marker (#2 function)
    90                   (Markup.command_timing_properties id elapsed)
    90                   (Markup.command_timing_properties id elapsed)
    91             | NONE => ())
    91             | NONE => ())
    92           else ()
    92           else ()
    93         end
    93         end
    94       else if function = Markup.theory_timing then
    94       else if function = Markup.theory_timing then
    95         Protocol_Message.inline_properties (#2 function) args
    95         Protocol_Message.marker (#2 function) args
    96       else
    96       else
    97         (case Markup.dest_loading_theory props of
    97         (case Markup.dest_loading_theory props of
    98           SOME name => Protocol_Message.inline_text "loading_theory" name
    98           SOME name => Protocol_Message.marker_text "loading_theory" name
    99         | NONE => Export.protocol_message props output)
    99         | NONE => Export.protocol_message props output)
   100   | [] => raise Output.Protocol_Message props);
   100   | [] => raise Output.Protocol_Message props);
   101 
   101 
   102 
   102 
   103 (* build theories *)
   103 (* build theories *)
   220       if name = Context.PureN then Theory.install_pure (Thy_Info.get_theory Context.PureN) else ();
   220       if name = Context.PureN then Theory.install_pure (Thy_Info.get_theory Context.PureN) else ();
   221   in () end;
   221   in () end;
   222 
   222 
   223 fun inline_errors exn =
   223 fun inline_errors exn =
   224   Runtime.exn_message_list exn
   224   Runtime.exn_message_list exn
   225   |> List.app (fn msg => Protocol_Message.inline_text "error_message" (YXML.content_of msg));
   225   |> List.app (fn msg => Protocol_Message.marker_text "error_message" (YXML.content_of msg));
   226 
   226 
   227 (*command-line tool*)
   227 (*command-line tool*)
   228 fun build args_file =
   228 fun build args_file =
   229   let
   229   let
   230     val _ = SHA1.test_samples ();
   230     val _ = SHA1.test_samples ();