Skip to content

Commit e37615c

Browse files
authored
Merge pull request #6041 from IntersectMBO/bench-master
bench: improve genesis cache retrieval; maintenance for `locli` and others
2 parents 6e969c6 + 186f0e7 commit e37615c

File tree

19 files changed

+220
-182
lines changed

19 files changed

+220
-182
lines changed

bench/locli/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Revision history for locli
2+
3+
## 1.36 -- Nov 2024
4+
5+
* Add `CHANGELOG.md` for `locli`
6+
* Discern Plutus RIPEMD-160 workload in reports
7+
* Remove unused build-depends
8+
* Remove redundant fields from summary report: Perf analysis start/stop spread, Log text lines per host (NB. incompatible for comparison with `summary.org` files created with prior versions)
9+
* Remove unused CLI commands `list-logobject-keys-legacy` and `list-logobject-keys`
10+
* Remove unused `HostLogs` SHA256 checksums
11+
* Disable missing trace detection (temporarily), as raw data isn't properly evaluated to that end at the moment

bench/locli/locli.cabal

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.0
22

33
name: locli
4-
version: 1.35
4+
version: 1.36
55
synopsis: Cardano log analysis CLI
66
description: Cardano log analysis CLI.
77
category: Cardano,
@@ -12,6 +12,7 @@ maintainer: [email protected]
1212
license: Apache-2.0
1313
license-files: LICENSE
1414
NOTICE
15+
extra-doc-files: CHANGELOG.md
1516
build-type: Simple
1617

1718
common project-config
@@ -95,11 +96,8 @@ library
9596
autogen-modules: Paths_locli
9697

9798
build-depends: aeson
98-
, Histogram
9999
, aeson-pretty
100100
, async
101-
, attoparsec
102-
, attoparsec-iso8601
103101
, bytestring
104102
, cardano-git-rev ^>= 0.2.2
105103
, cardano-ledger-core
@@ -110,27 +108,16 @@ library
110108
, directory
111109
, ede
112110
, extra
113-
, file-embed
114111
, filepath
115112
, fingertree
116113
, hashable
117-
, gnuplot
118-
, iohk-monitoring
119-
, optparse-applicative-fork
120-
, optparse-generic
114+
, optparse-applicative-fork >= 0.18.1
121115
, ouroboros-consensus
122-
-- for Data.SOP.Strict:
123-
, ouroboros-network ^>= 0.17
124-
, ouroboros-network-api
125-
, process
126-
, quiet
127-
, scientific
116+
, ouroboros-network-api ^>= 0.10
128117
, sop-core
129118
, split
130119
, statistics
131120
, strict-sop-core
132-
, system-filepath
133-
, template-haskell
134121
, text
135122
, text-short
136123
, time
@@ -139,18 +126,15 @@ library
139126
, transformers-except
140127
, unix
141128
, unordered-containers
142-
, utf8-string
143129
, vector
144130
, witherable
145-
, cardano-strict-containers ^>= 0.1
146131

147132
executable locli
148133
import: project-config
149134

150135
hs-source-dirs: app
151136
main-is: locli.hs
152137
ghc-options: -threaded
153-
-Wall
154138
-rtsopts
155139
"-with-rtsopts=-T -N7 -A2m -qb -H64m"
156140

bench/locli/src/Cardano/Analysis/API/Ground.hs

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ module Cardano.Analysis.API.Ground
1010
)
1111
where
1212

13-
import Prelude (show)
13+
import Prelude as P (show)
1414
import Cardano.Prelude hiding (head, toText)
1515
import Unsafe.Coerce qualified as Unsafe
1616

1717
import Data.Aeson
1818
import Data.Aeson.Types (toJSONKeyText)
19-
import Data.Attoparsec.Text qualified as Atto
20-
import Data.Attoparsec.Time qualified as Iso8601
2119
import Data.ByteString.Lazy.Char8 qualified as LBS
2220
import Data.Map.Strict qualified as Map
2321
import Data.Text qualified as T
@@ -26,7 +24,6 @@ import Data.Text.Short (ShortText, fromText, toText)
2624
import Data.Time.Clock (UTCTime, NominalDiffTime)
2725
import Options.Applicative
2826
import Options.Applicative qualified as Opt
29-
import Quiet (Quiet (..))
3027
import System.FilePath qualified as F
3128

3229
import Cardano.Slotting.Slot (EpochNo(..), SlotNo(..))
@@ -41,13 +38,17 @@ newtype FieldName = FieldName { unFieldName :: Text }
4138
deriving (Eq, Generic, Ord)
4239
deriving newtype (FromJSON, IsString, ToJSON)
4340
deriving anyclass NFData
44-
deriving Show via Quiet FieldName
41+
42+
instance Show FieldName where
43+
show = ("FieldName " ++) . P.show . unFieldName
4544

4645
newtype TId = TId { unTId :: ShortText }
4746
deriving (Eq, Generic, Ord)
4847
deriving newtype (FromJSON, ToJSON)
4948
deriving anyclass NFData
50-
deriving Show via Quiet TId
49+
50+
instance Show TId where
51+
show = ("TId " ++) . P.show . unTId
5152

5253
newtype Hash = Hash { unHash :: ShortText }
5354
deriving (Eq, Generic, Ord)
@@ -95,7 +96,9 @@ newtype Host = Host { unHost :: ShortText }
9596
deriving (Eq, Generic, Ord)
9697
deriving newtype (IsString, FromJSON, ToJSON)
9798
deriving anyclass NFData
98-
deriving Show via Quiet Host
99+
100+
instance Show Host where
101+
show = ("Host " ++) . P.show . unHost
99102

100103
newtype EpochSlot = EpochSlot { unEpochSlot :: Word64 }
101104
deriving stock (Eq, Generic, Ord, Show)
@@ -269,26 +272,6 @@ pSlotNo name desc =
269272
<> Opt.help desc
270273
)
271274

272-
optUTCTime :: String -> String -> Parser UTCTime
273-
optUTCTime optname desc =
274-
Opt.option (readerFromAttoParser Iso8601.utcTime)
275-
$ long optname
276-
<> metavar "ISO8601-TIME"
277-
<> help desc
278-
where
279-
-- Stolen from: cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
280-
readerFromAttoParser :: Atto.Parser a -> Opt.ReadM a
281-
readerFromAttoParser p =
282-
Opt.eitherReader (Atto.parseOnly (p <* Atto.endOfInput) . T.pack)
283-
284-
optDuration :: String -> String -> NominalDiffTime -> Parser NominalDiffTime
285-
optDuration optname desc def=
286-
Opt.option ((realToFrac :: Double -> NominalDiffTime) <$> Opt.auto)
287-
$ long optname
288-
<> metavar "SEC"
289-
<> help desc
290-
<> value def
291-
292275
optWord :: String -> String -> Word64 -> Parser Word64
293276
optWord optname desc def =
294277
Opt.option auto

bench/locli/src/Cardano/Analysis/API/Metrics.hs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ sumFieldsReport =
4848
, "plutusScript"
4949
, "sumHosts", "sumLogObjectsTotal"
5050
, "sumFilters"
51-
, "cdfLogLinesEmitted", "cdfLogObjectsEmitted", "cdfLogObjects"
51+
, "cdfLogObjectsEmitted", "cdfLogObjects"
5252
, "cdfRuntime", "cdfLogLineRate"
5353
, "ddRawCount.sumDomainTime", "ddFilteredCount.sumDomainTime", "dataDomainFilterRatio.sumDomainTime"
5454
, "ddRaw.sumStartSpread", "ddRaw.sumStopSpread"
55-
, "ddFiltered.sumStartSpread", "ddFiltered.sumStopSpread"
5655
, "sumDomainSlots", "sumDomainBlocks", "sumBlocksRejected"]
5756

5857
instance (KnownCDF f) => TimelineFields (Summary f) where
@@ -95,8 +94,8 @@ instance (KnownCDF f) => TimelineFields (Summary f) where
9594
""
9695

9796
<> fScalar "utxo" W12 Cnt (IWord64 $ utxo.sumGenesisSpec)
98-
"Starting UTxO set size"
99-
"Extra UTxO set size at the beginning of the benchmark"
97+
"Stuffed UTxO size"
98+
"Extra UTxO set entries (from genesis)"
10099

101100
<> fScalar "dreps" W12 Cnt (IWord64 $ dreps.sumGenesisSpec)
102101
"DRep count"
@@ -136,10 +135,6 @@ instance (KnownCDF f) => TimelineFields (Summary f) where
136135
"Number of filters applied"
137136
""
138137

139-
<> fScalar "cdfLogLinesEmitted" W12 Cnt (IFloat $ cdfAverageVal.cdfLogLinesEmitted)
140-
"Log text lines emitted per host"
141-
""
142-
143138
<> fScalar "cdfLogObjectsEmitted" W12 Cnt (IFloat $ cdfAverageVal.cdfLogObjectsEmitted)
144139
"Log objects emitted per host"
145140
""
@@ -180,14 +175,6 @@ instance (KnownCDF f) => TimelineFields (Summary f) where
180175
"Node stop spread, s"
181176
""
182177

183-
<> fScalar "ddFiltered.sumStartSpread" W9 Sec (IDeltaT$ maybe 0 (intvDurationSec.fmap (fromRUTCTime . arityProj cdfMedian)).ddFiltered.sumStartSpread)
184-
"Perf analysis start spread, s"
185-
""
186-
187-
<> fScalar "ddFiltered.sumStopSpread" W9 Sec (IDeltaT$ maybe 0 (intvDurationSec.fmap (fromRUTCTime . arityProj cdfMedian)).ddFiltered.sumStopSpread)
188-
"Perf analysis stop spread, s"
189-
""
190-
191178
<> fScalar "sumDomainSlots" W12 Slo (IInt $ floor.arityProj cdfMedian.cdfAverage.ddFilteredCount.sumDomainSlots)
192179
"Slots analysed"
193180
""
@@ -211,7 +198,6 @@ instance (KnownCDF f) => TimelineFields (Summary f) where
211198
, manifestPackages <&> pkgCommit
212199
]
213200

214-
215201
-- fieldJSONOverlay f = (:[]) . tryOverlayFieldDescription f
216202

217203
propSubsetFn :: PropSubset -> (Field DSelect p a -> Bool)

bench/locli/src/Cardano/Analysis/API/Types.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ data Summary f where
5050
, sumDomainBlocks :: !(DataDomain f BlockNo)
5151
, sumProfilingData :: !(Maybe (ProfilingData (CDF I)))
5252

53-
, cdfLogLinesEmitted :: !(CDF f Int)
5453
, cdfLogObjectsEmitted :: !(CDF f Int)
5554
, cdfLogObjects :: !(CDF f Int)
5655
, cdfRuntime :: !(CDF f NominalDiffTime)

bench/locli/src/Cardano/Analysis/Summary.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ summariseMultiSummary sumAnalysisTime centiles xs@(headline:xss) = do
7171
sumMeta <- summariseMetadata $ xs <&> sumMeta
7272
sumFilters <- allEqOrElse (xs <&> sumFilters) SEIncoherentRunFilters
7373

74-
cdfLogLinesEmitted <- sumCDF2 $ xs <&> cdfLogLinesEmitted
7574
cdfLogObjectsEmitted <- sumCDF2 $ xs <&> cdfLogObjectsEmitted
7675
cdfLogObjects <- sumCDF2 $ xs <&> cdfLogObjects
7776
cdfRuntime <- sumCDF2 $ xs <&> cdfRuntime
@@ -172,7 +171,6 @@ computeSummary sumAnalysisTime
172171
--
173172
, cdfLogObjects = cdf stdCentiles (objLists <&> length)
174173
, cdfLogObjectsEmitted = cdf stdCentiles logObjectsEmitted
175-
, cdfLogLinesEmitted = cdf stdCentiles textLinesEmitted
176174
, cdfRuntime = cdf stdCentiles runtimes
177175
, ..
178176
}
@@ -183,7 +181,7 @@ computeSummary sumAnalysisTime
183181
rlHostLogs
184182
& Map.elems
185183

186-
(,) logObjectsEmitted textLinesEmitted =
184+
(logObjectsEmitted, textLinesEmitted) =
187185
hostLogs
188186
& fmap (hlRawLogObjects &&& hlRawLines)
189187
& unzip
@@ -198,7 +196,7 @@ computeSummary sumAnalysisTime
198196
lineRates = zipWith (/) (textLinesEmitted <&> fromIntegral)
199197
(runtimes <&> fromIntegral @Int . truncate)
200198

201-
(,,) sumDomainTime sumStartSpread sumStopSpread =
199+
(sumDomainTime, sumStartSpread, sumStopSpread) =
202200
slotDomains sumGenesis (losFirsts, losLasts) mpDomainSlots
203201

204202
sumChainRejectionStats :: [(ChainFilter, Int)]

bench/locli/src/Cardano/Command.hs

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ newtype Command
4747
deriving Show
4848

4949
data ChainCommand
50-
= ListLogobjectKeys TextOutputFile
51-
| ListLogobjectKeysLegacy TextOutputFile
52-
53-
| ReadMetaGenesis (JsonInputFile RunPartial) (JsonInputFile Genesis)
50+
= ReadMetaGenesis (JsonInputFile RunPartial) (JsonInputFile Genesis)
5451
| WriteMetaGenesis TextOutputFile TextOutputFile
5552

5653
| Unlog (JsonInputFile (RunLogs ())) Bool (Maybe [LOAnyType])
@@ -104,12 +101,6 @@ data ChainCommand
104101
parseChainCommand :: Parser ChainCommand
105102
parseChainCommand =
106103
subparser (mconcat [ commandGroup "Common data: logobject keys, run metafile & genesis"
107-
, op "list-logobject-keys" "List logobject keys that analyses care about"
108-
(ListLogobjectKeys
109-
<$> optTextOutputFile "keys" "Text file to write logobject keys to")
110-
, op "list-logobject-keys-legacy" "List legacy logobject keys that analyses care about"
111-
(ListLogobjectKeysLegacy
112-
<$> optTextOutputFile "keys-legacy" "Text file to write logobject keys to")
113104
, op "read-meta-genesis" "Read the run metadata: meta.json and Shelley genesis"
114105
(ReadMetaGenesis
115106
<$> optJsonInputFile "run-metafile" "The meta.json file from the benchmark run"
@@ -391,22 +382,9 @@ sAnchor State{sTags=[]} = error "sAnchor with no run or multi-summary."
391382
sAnchor s@State{sTags}
392383
= stateAnchor sTags s
393384

394-
quote :: T.Text -> T.Text
395-
quote = (<> "\"") . ("\"" <>)
396385

397386
runChainCommand :: State -> ChainCommand -> ExceptT CommandError IO State
398387

399-
runChainCommand s
400-
c@(ListLogobjectKeys f) = do
401-
dumpText "logobject-keys" (quote . toText <$> logObjectStreamInterpreterKeys) f
402-
& firstExceptT (CommandError c)
403-
pure s
404-
runChainCommand s
405-
c@(ListLogobjectKeysLegacy f) = do
406-
dumpText "logobject-keys-legacy" (quote . toText <$> logObjectStreamInterpreterKeysLegacy) f
407-
& firstExceptT (CommandError c)
408-
pure s
409-
410388
runChainCommand s
411389
c@(ReadMetaGenesis runMeta shelleyGenesis) = do
412390
progress "run" (Q $ printf "reading run metadata & Shelley genesis")
@@ -601,7 +579,7 @@ runChainCommand s@State{sRun=Just _run, sSlots=Just slots}
601579
runChainCommand _ c@TimelineSlots{} = missingCommandData c
602580
["run metadata & genesis", "filtered slots"]
603581

604-
runChainCommand s@State{sRun=Just run, sChain=Just chain@Chain{..}, sRunLogs}
582+
runChainCommand s@State{sRun=Just run, sChain=Just chain@Chain{..}}
605583
c@ComputePropagation = do
606584
progress "block-propagation" $ J (cDomBlocks, cDomSlots)
607585
prop <- pure (blockProp run chain)
@@ -615,9 +593,11 @@ runChainCommand s@State{sRun=Just run, sChain=Just chain@Chain{..}, sRunLogs}
615593
renderBlockPropError e
616594
<> maybe "" ((".\n\n Missing traces in run logs (not all are fatal):\n\n " <>)
617595
. T.intercalate "\n "
618-
. fmap toText
619-
. rlMissingTraces)
620-
sRunLogs
596+
. const []
597+
)
598+
Nothing
599+
-- TODO: reactivate output once there's a proper evaluation of raw data
600+
621601
runChainCommand _ c@ComputePropagation = missingCommandData c
622602
["run metadata & genesis", "chain", "data domains for slots & blocks"]
623603

bench/locli/src/Cardano/Report.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ data Workload
8080
| WPlutusLoopCountdown
8181
| WPlutusLoopSECP
8282
| WPlutusLoopBLST
83+
| WPlutusLoopRipemd
8384
| WPlutusUnknown
8485

8586
instance ToJSON Workload where
@@ -88,13 +89,15 @@ instance ToJSON Workload where
8889
WPlutusLoopCountdown -> "Plutus countdown loop"
8990
WPlutusLoopSECP -> "Plutus SECP loop"
9091
WPlutusLoopBLST -> "Plutus BLST loop"
92+
WPlutusLoopRipemd -> "Plutus RIPEMD-160 loop"
9193
WPlutusUnknown -> "Plutus (other)"
9294

9395
filenameInfix :: Workload -> Text
9496
filenameInfix = \case
9597
WPlutusLoopCountdown -> "plutus"
9698
WPlutusLoopSECP -> "plutus-secp"
9799
WPlutusLoopBLST -> "plutus-blst"
100+
WPlutusLoopRipemd -> "plutus-ripemd"
98101
WValue -> "value-only"
99102
_ -> "unknown"
100103

@@ -150,6 +153,7 @@ liftTmplRun Summary{sumWorkload=generatorProfile
150153
| script == "EcdsaSecp256k1Loop" -> WPlutusLoopSECP
151154
| script == "SchnorrSecp256k1Loop" -> WPlutusLoopSECP
152155
| script == "HashOntoG2AndAdd" -> WPlutusLoopBLST
156+
| script == "Ripemd160" -> WPlutusLoopRipemd
153157
| otherwise -> WPlutusUnknown
154158
}
155159

bench/locli/src/Cardano/Unlog/LogObject.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,8 @@ data HostLogs a
8787
= HostLogs
8888
{ hlRawLogfiles :: [FilePath]
8989
, hlRawLines :: Int
90-
, hlRawSha256 :: Hash
9190
, hlRawTraceFreqs :: Map Text Int
92-
, hlMissingTraces :: [Text]
9391
, hlLogs :: (JsonLogfile, a)
94-
, hlFilteredSha256 :: Hash
9592
, hlProfile :: [ProfileEntry I]
9693
, hlRawFirstAt :: Maybe UTCTime
9794
, hlRawLastAt :: Maybe UTCTime
@@ -107,8 +104,6 @@ hlRawLogObjects = sum . Map.elems . hlRawTraceFreqs
107104
data RunLogs a
108105
= RunLogs
109106
{ rlHostLogs :: Map.Map Host (HostLogs a)
110-
, rlMissingTraces :: [Text]
111-
, rlFilterKeys :: [Text]
112107
, rlFilterDate :: UTCTime
113108
}
114109
deriving (Generic, FromJSON, ToJSON)

0 commit comments

Comments
 (0)