mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-06 11:15:43 -05:00
details for leancheck
This commit is contained in:
parent
70f0b3874c
commit
cd07d6924b
4 changed files with 15 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
(executable
|
(executable
|
||||||
(name leancheck)
|
(name leancheck)
|
||||||
(flags :standard -w +32 -open Sidekick_sigs -open Sidekick_util)
|
(flags :standard -w +32 -open Sidekick_sigs -open Sidekick_util)
|
||||||
(libraries containers sidekick.core-logic sidekick.util))
|
(libraries containers sidekick.core-logic sidekick.util mtime mtime.clock.os))
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,31 @@ module T = Sidekick_core_logic.Term
|
||||||
let ( let@ ) = ( @@ )
|
let ( let@ ) = ( @@ )
|
||||||
|
|
||||||
let process_files (files : string list) : unit =
|
let process_files (files : string list) : unit =
|
||||||
|
let start = Mtime_clock.now () in
|
||||||
let st = T.Store.create ~size:1024 () in
|
let st = T.Store.create ~size:1024 () in
|
||||||
Log.debugf 1 (fun k ->
|
Log.debugf 1 (fun k ->
|
||||||
k "(@[process-files %a@])" Fmt.Dump.(list string) files);
|
k "(@[process-files %a@])" Fmt.Dump.(list string) files);
|
||||||
|
|
||||||
|
let n_lines = ref 0 in
|
||||||
|
|
||||||
let proc_file (file : string) : unit =
|
let proc_file (file : string) : unit =
|
||||||
let@ ic = CCIO.with_in file in
|
let@ ic = CCIO.with_in file in
|
||||||
Parse.parse (`In ic)
|
Parse.parse (`In ic)
|
||||||
(module struct
|
(module struct
|
||||||
|
let line _ = incr n_lines
|
||||||
let ns _ _ = ()
|
let ns _ _ = ()
|
||||||
let ni _ _ = ()
|
let ni _ _ = ()
|
||||||
end)
|
end)
|
||||||
in
|
in
|
||||||
|
|
||||||
List.iter proc_file files;
|
List.iter proc_file files;
|
||||||
|
|
||||||
|
let elapsed =
|
||||||
|
(Mtime.span (Mtime_clock.now ()) start |> Mtime.Span.to_float_ns) /. 1e9
|
||||||
|
in
|
||||||
|
Log.debugf 1 (fun k ->
|
||||||
|
k "number of lines processed: %d in %.4fs (%.2f/s)" !n_lines elapsed
|
||||||
|
(float !n_lines /. elapsed));
|
||||||
()
|
()
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,8 @@ let parse (input : input) (cb : callback) : unit =
|
||||||
match IN.next_line () with
|
match IN.next_line () with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some line ->
|
| Some line ->
|
||||||
Printf.eprintf "line %S\n" line;
|
Log.debugf 50 (fun k -> k "(leancheck.parse-line %S)" line);
|
||||||
|
CB.line line;
|
||||||
|
|
||||||
(* TODO: cb *)
|
(* TODO: cb *)
|
||||||
loop ()
|
loop ()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
module type CALLBACK = sig
|
module type CALLBACK = sig
|
||||||
|
val line : string -> unit
|
||||||
val ns : int -> string -> unit
|
val ns : int -> string -> unit
|
||||||
val ni : int -> int -> unit
|
val ni : int -> int -> unit
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue