Skip to content

Commit

Permalink
Remove BenchmarkLedgerOpsState, and use ExtLedgerState directly
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadales committed Dec 2, 2022
1 parent a3b8504 commit f60000b
Showing 1 changed file with 5 additions and 16 deletions.
Expand Up @@ -478,13 +478,6 @@ traceLedgerProcessing
- Block validation.
-------------------------------------------------------------------------------}

newtype BenchmarkLedgerOpsState blk = BenchmarkLedgerOpsState {
-- | Intermediate ledger state to which the next block will be applied.
prevLedgerState :: ExtLedgerState blk
}


benchmarkLedgerOps ::
forall blk.
( HasAnalysis blk
Expand All @@ -493,14 +486,10 @@ benchmarkLedgerOps ::
=> Maybe FilePath -> Analysis blk
benchmarkLedgerOps mOutfile AnalysisEnv {db, registry, initLedger, cfg, limit} =
withFile mOutfile $ \outFileHandle -> do

let
IO.hPutStrLn outFileHandle $ DP.showHeaders separator
++ "...era-specific stats"

let st0 = BenchmarkLedgerOpsState initLedger

void $ processAll db registry GetBlock initLedger limit st0 (process outFileHandle)
void $ processAll db registry GetBlock initLedger limit initLedger (process outFileHandle)
where
withFile :: Maybe FilePath -> (IO.Handle -> IO r) -> IO r
withFile (Just outfile) = IO.withFile outfile IO.WriteMode
Expand All @@ -514,10 +503,10 @@ benchmarkLedgerOps mOutfile AnalysisEnv {db, registry, initLedger, cfg, limit} =

process ::
IO.Handle
-> BenchmarkLedgerOpsState blk
-> ExtLedgerState blk
-> blk
-> IO (BenchmarkLedgerOpsState blk)
process outFileHandle BenchmarkLedgerOpsState {prevLedgerState} blk = do
-> IO (ExtLedgerState blk)
process outFileHandle prevLedgerState blk = do
prevRtsStats <- GC.getRTSStats
let slot = blockSlot blk
(!tkLdgrView, tForecast) <- forecast slot prevLedgerState
Expand Down Expand Up @@ -553,7 +542,7 @@ benchmarkLedgerOps mOutfile AnalysisEnv {db, registry, initLedger, cfg, limit} =
++ intercalate separator (HasAnalysis.blockStats blk)
)

pure $ BenchmarkLedgerOpsState $ ExtLedgerState ldgrSt' hdrSt'
pure $ ExtLedgerState ldgrSt' hdrSt'
where
rp = blockRealPoint blk

Expand Down

0 comments on commit f60000b

Please sign in to comment.