Skip to content

Commit 1c62120

Browse files
committed
extra logging for convenience
1 parent 09a72b0 commit 1c62120

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/FSLibrary/MinBlockTimeTest.fs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ let private checkLedgerAgeSLA (percentiles: (Peer * float * float) list) (target
226226
let tHi = tf * 1.20
227227
let p99Max = tf * 2.0
228228
let mutable ok = true
229+
let formatDeviation value =
230+
let deviation = (value - tf) / tf * 100.0
231+
232+
if deviation >= 0.0 then
233+
sprintf "+%.1f%%" deviation
234+
else
235+
sprintf "%.1f%%" deviation
229236

230237
for peer, p75, p99 in percentiles do
231238
let peerOk = p75 >= tLo && p75 < tHi && p99 <= p99Max
@@ -240,6 +247,18 @@ let private checkLedgerAgeSLA (percentiles: (Peer * float * float) list) (target
240247

241248
if not peerOk then ok <- false
242249

250+
if not percentiles.IsEmpty then
251+
let avgP75 = percentiles |> List.averageBy (fun (_, p75, _) -> p75)
252+
let avgP99 = percentiles |> List.averageBy (fun (_, _, p99) -> p99)
253+
254+
LogInfo
255+
"all peers T=%dms avg-p75=%.0f (%s vs target) avg-p99=%.0f (%s vs target)"
256+
targetMs
257+
avgP75
258+
(formatDeviation avgP75)
259+
avgP99
260+
(formatDeviation avgP99)
261+
243262
ok
244263

245264
let minBlockTimeTest (context: MissionContext) (baseLoadGen: LoadGen) (setupCfg: LoadGen option) =

0 commit comments

Comments
 (0)