• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A Nix-friendly SQLite-enhanced fork of Flitter, a speedrunning split timer for Unix-style terminals


Commit MetaInfo

修订版442635013a88c060ff0fd919ce7ae048b4a7b418 (tree)
时间2023-05-26 03:11:22
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Finish hacking on summary tool.

All of the queries seem to report accurate data. Summation of segments
across categories is working; if you run a game that branches into many
categories, then statistics are accumulated across all categories.

更改概述

差异

--- a/bin/summary_main.ml
+++ b/bin/summary_main.ml
@@ -14,6 +14,8 @@ let add_stdev db =
1414 ~step:(fun w d -> Welford.observe w (Data.to_int_exn d))
1515 ~final:(fun w -> Data.FLOAT (Welford.stddev w))
1616
17+let duration_of_float f = Duration.to_string (int_of_float f) 3
18+
1719 let () =
1820 match Sys.get_argv () with
1921 | [| _; db_path |] ->
@@ -33,25 +35,24 @@ let () =
3335 (Data.to_string_exn row.(1))
3436 (Duration.to_string (Data.to_int_exn row.(3)) 3)
3537 (Data.to_int_exn row.(2))
36- (Duration.to_string
37- (int_of_float (Data.to_float_exn row.(4)))
38- 3)
39- (Duration.to_string
40- (int_of_float (Data.to_float_exn row.(5)))
41- 3))))
38+ (duration_of_float (Data.to_float_exn row.(4)))
39+ (duration_of_float (Data.to_float_exn row.(5))))))
4240 | [| _; db_path; game; category |] ->
4341 Storage.with_db db_path (fun db ->
4442 add_stdev db;
4543 let vals = [ Data.TEXT game; Data.TEXT category ] in
4644 let stmt =
4745 prepare db
48- "with path(end, i) as (select starting_at, 0 from routes where \
49- game = ?1 and category = ?2 union select ending_at, path.i + 1 \
50- from segments, path where game = ?1 and category = ?2 and \
46+ "with path(start, end, i) as (select segments.starting_at, \
47+ segments.ending_at, 0 from segments, routes where routes.game = \
48+ ?1 and routes.category = ?2 and segments.starting_at = \
49+ routes.starting_at union select starting_at, ending_at, path.i \
50+ + 1 from segments, path where game = ?1 and category = ?2 and \
5151 starting_at = path.end) select starting_at, ending_at, \
5252 min(duration), avg(duration), stdev(duration) from path, \
53- segments where game = ?1 and category = ?2 and ending_at = \
54- path.end group by starting_at, ending_at order by path.i;"
53+ segments where game = ?1 and starting_at = path.start and \
54+ ending_at = path.end group by starting_at, ending_at order by \
55+ path.i;"
5556 in
5657 check_select stmt vals (fun row ->
5758 print_string
@@ -59,12 +60,8 @@ let () =
5960 (Data.to_string_exn row.(0))
6061 (Data.to_string_exn row.(1))
6162 (Duration.to_string (Data.to_int_exn row.(2)) 3)
62- (Duration.to_string
63- (int_of_float (Data.to_float_exn row.(3)))
64- 3)
65- (Duration.to_string
66- (int_of_float (Data.to_float_exn row.(4)))
67- 3))))
63+ (duration_of_float (Data.to_float_exn row.(3)))
64+ (duration_of_float (Data.to_float_exn row.(4))))))
6865 | [| _; db_path; game; category; attempt |] ->
6966 Storage.with_db db_path (fun db ->
7067 let vals =
@@ -75,13 +72,17 @@ let () =
7572 ]
7673 in
7774 let stmt =
75+ (* XXX SELECT DISTINCT required because path sometimes repeats i *)
7876 prepare db
79- "with path(end, i) as (select 'New Game', 0 union select \
80- ending_at, path.i + 1 from segments, path where game = ?1 and \
81- category = ?2 and attempt = ?3 and starting_at = path.end) \
82- select starting_at, ending_at, duration from path, segments \
83- where game = ?1 and category = ?2 and attempt = ?3 and \
84- ending_at = path.end order by path.i;"
77+ "with path(start, end, i) as (select segments.starting_at, \
78+ segments.ending_at, 0 from segments, routes where routes.game = \
79+ ?1 and routes.category = ?2 and segments.starting_at = \
80+ routes.starting_at union select starting_at, ending_at, path.i \
81+ + 1 from segments, path where game = ?1 and category = ?2 and \
82+ attempt = ?3 and starting_at = path.end) select distinct \
83+ starting_at, ending_at, duration from path, segments where game \
84+ = ?1 and category = ?2 and attempt = ?3 and starting_at = \
85+ path.start and ending_at = path.end order by path.i;"
8586 in
8687 check_select stmt vals (fun row ->
8788 print_string