Debian Codegraph @

dev/bench/timelogparser.ml

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open BenchUtil
12
13 let time_regex = Str.regexp {|^Chars \([0-9]+\) - \([0-9]+\) [^ ]+ \([0-9.]+\) secs|}
14
15 let rec parse_loop filech acc =
16 match input_line filech with
17 | exception End_of_file ->
18 List.rev acc
19 | l ->
20 if not (Str.string_match time_regex l 0) then
21 parse_loop filech acc
22 else
23 let b = int_of_string @@ Str.matched_group 1 l
24 and e = int_of_string @@ Str.matched_group 2 l
25 and t = Str.matched_group 3 l in
26 let v = { start_char = b; stop_char = e; }, { str = t; q = Q.of_string t } in
27 parse_loop filech (v :: acc)
28
29 let parse ~file =
30 let ch = open_in file in
31 let v = parse_loop ch [] in
32 close_in ch;
33 v