Skip to content

Commit 907ba20

Browse files
authored
Merge pull request IntersectMBO#5535 from input-output-hk/bench-master
workbench: various improvements + future proofing
2 parents db0f829 + c39e50c commit 907ba20

File tree

16 files changed

+760
-684
lines changed

16 files changed

+760
-684
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ PROFILES_MODEL += model-value-test
8787
PROFILES_10 := 10 10-p2p 10-plutus 10-notracer
8888
PROFILES_FORGE_STRESS := forge-stress forge-stress-p2p forge-stress-plutus forge-stress-plutus-solo forge-stress-notracer forge-stress-large forge-stress-solo forge-stress-light
8989
PROFILES_FORGE_STRESS_PRE := forge-stress-pre forge-stress-pre-plutus forge-stress-pre-notracer forge-stress-pre-solo
90-
PROFILES_FORGE_STRESS_RTS := forge-stress-pre-rtsA4m forge-stress-pre-rtsA64m forge-stress-pre-rtsN3 forge-stress-pre-rtsA4mN3 forge-stress-pre-rtsA64mN3
90+
PROFILES_FORGE_STRESS_RTS := forge-stress-pre-rtsA4m forge-stress-pre-rtsA64m forge-stress-pre-rtsN3 forge-stress-pre-rtsA4mN3 forge-stress-pre-rtsA64mN3 forge-stress-pre-rtsxn
9191
PROFILES_CHAINSYNC := chainsync-early-byron chainsync-early-byron-notracer chainsync-early-byron-oldtracing
9292
PROFILES_CHAINSYNC += chainsync-early-alonzo chainsync-early-alonzo-notracer chainsync-early-alonzo-oldtracing chainsync-early-alonzo-p2p
9393
PROFILES_VENDOR := dish dish-plutus dish-10M dish-10M-plutus

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,34 +197,36 @@ manifestPackages =
197197

198198
data Metadata
199199
= Metadata
200-
{ tag :: Text
201-
, batch :: Text
202-
, ident :: Text
203-
, profile :: Text
204-
, era :: Text
205-
, manifest :: Manifest
206-
, profile_content :: AE.KeyMap Value
200+
{ tag :: Text
201+
, batch :: Text
202+
, ident :: Text
203+
, node_ghc_version :: Text
204+
, profile :: Text
205+
, era :: Text
206+
, manifest :: Manifest
207+
, profile_content :: AE.KeyMap Value
207208
}
208209
deriving (Generic, NFData, Show, ToJSON)
209210

210211
instance FromJSON Metadata where
211212
parseJSON =
212213
withObject "Metadata" $ \v -> do
213214

214-
tag <- v .: "tag"
215-
batch <- v .: "batch"
216-
manifest <- (v .: "manifest")
215+
tag <- v .: "tag"
216+
batch <- v .: "batch"
217+
manifest <- (v .: "manifest")
217218
<|> compatParseManifest v
218-
profile <- v .: "profile"
219-
profile_content <- v .: "profile_content"
220-
generator <- profile_content .: "generator"
219+
profile <- v .: "profile"
220+
profile_content <- v .: "profile_content"
221+
generator <- profile_content .: "generator"
221222

222-
ident <- (v .:? "ident")
223-
<&> fromMaybe (unVersion . ciVersion $
223+
ident <- (v .:? "ident")
224+
<&> fromMaybe (unVersion . ciVersion $
224225
getComponent "cardano-node" manifest)
225-
eraDirect <- v .:? "era"
226-
eraProfile <- profile_content .:? "era"
227-
eraGenerator <- generator .:? "era"
226+
node_ghc_version <- v .:? "node_ghc_version" .!= "unknown"
227+
eraDirect <- v .:? "era"
228+
eraProfile <- profile_content .:? "era"
229+
eraGenerator <- generator .:? "era"
228230
era <- case eraDirect <|> eraProfile <|> eraGenerator of
229231
Just x -> pure x
230232
Nothing -> fail "While parsing run metafile: missing era specification"

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ sumFieldsReport =
4040
[ "date.systemStart", "time.systemStart", "sumAnalysisTime"
4141
, "ident"
4242
, "batch"
43+
, "ghc_version"
4344
] ++ (FieldName <$> manifestPackages) ++
4445
[ "era"
4546
, "delegators", "utxo"
@@ -79,6 +80,10 @@ instance (KnownCDF f) => TimelineFields (Summary f) where
7980
"Run batch"
8081
""
8182

83+
<> fScalar "ghc_version" Wno Id (IText $ node_ghc_version.sumMeta)
84+
"GHC version"
85+
"GHC version used to build cardano-node"
86+
8287
<> manifestFields
8388

8489
<> fScalar "era" Wno Era (IText $ era.sumMeta)

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ data SummaryError
3030
| SEIncoherentRunEras [Text]
3131
| SEIncoherentRunVersions [Manifest]
3232
| SEIncoherentRunFilters [([FilterName], [ChainFilter])]
33+
| SEIncoherentCompilerVersions [Text]
3334
| SECDFError CDFError
3435
deriving Show
3536

@@ -96,10 +97,11 @@ summariseMultiSummary sumAnalysisTime centiles xs@(headline:xss) = do
9697
summariseMetadata :: [Metadata] -> Either SummaryError Metadata
9798
summariseMetadata [] = Left SEEmptyDataset
9899
summariseMetadata xs@(headline:_) = do
99-
profile <- allEqOrElse (xs <&> profile) SEIncoherentRunProfileNames
100-
era <- allEqOrElse (xs <&> era) SEIncoherentRunEras
101-
manifest <- allEqOrElse (xs <&> manifest) SEIncoherentRunVersions
102-
profile_content <- allEqOrElse (xs <&> profile_content) SEIncoherentRunProfiles
100+
profile <- allEqOrElse (xs <&> profile) SEIncoherentRunProfileNames
101+
era <- allEqOrElse (xs <&> era) SEIncoherentRunEras
102+
manifest <- allEqOrElse (xs <&> manifest) SEIncoherentRunVersions
103+
profile_content <- allEqOrElse (xs <&> profile_content) SEIncoherentRunProfiles
104+
node_ghc_version <- allEqOrElse (xs <&> node_ghc_version) SEIncoherentCompilerVersions
103105
-- XXX: magic transformation that happens to match
104106
-- the logic in 'analyse.sh multi-call' on line with "local run="
105107
pure Metadata { tag = multiRunTag (Just "variance") xs

bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/CustomCall.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
{-# OPTIONS_GHC -fno-warn-orphans #-}
99

10+
-- PlutusV2 must be compiled using plc 1.0
11+
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
12+
1013
module Cardano.Benchmarking.PlutusScripts.CustomCall (script) where
1114

1215
import Language.Haskell.TH

bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/EcdsaSecp256k1Loop.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
{-# LANGUAGE TypeApplications #-}
55
{-# LANGUAGE TypeFamilies #-}
66

7+
-- PlutusV2 must be compiled using plc 1.0
8+
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
9+
710
module Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop (script) where
811

912
import Language.Haskell.TH

bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
{-# LANGUAGE TypeApplications #-}
55
{-# LANGUAGE TypeFamilies #-}
66

7+
-- PlutusV1 must be compiled using plc 1.0
8+
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
9+
710
module Cardano.Benchmarking.PlutusScripts.Loop (script) where
811

912
import Language.Haskell.TH
@@ -14,7 +17,7 @@ import Cardano.Api.Shelley (PlutusScript (..), PlutusScriptV1, Script(
1417
import Cardano.Benchmarking.ScriptAPI
1518
import qualified Data.ByteString.Short as SBS
1619

17-
import qualified PlutusLedgerApi.V2 as PlutusV2
20+
import qualified PlutusLedgerApi.V1 as PlutusV1
1821
import PlutusTx
1922
import PlutusTx.Builtins (unsafeDataAsI)
2023
import PlutusTx.Prelude hiding (Semigroup (..), unless, (.), (<$>))
@@ -39,7 +42,7 @@ mkValidator _datum redeemer _txContext
3942
loop i = if i == 1000000 then () else loop $ pred i
4043

4144
loopScriptShortBs :: SBS.ShortByteString
42-
loopScriptShortBs = PlutusV2.serialiseCompiledCode $$(PlutusTx.compile [|| mkValidator ||])
45+
loopScriptShortBs = PlutusV1.serialiseCompiledCode $$(PlutusTx.compile [|| mkValidator ||])
4346

4447
scriptSerialized :: PlutusScript PlutusScriptV1
4548
scriptSerialized = PlutusScriptSerialised loopScriptShortBs

bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/SchnorrSecp256k1Loop.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
{-# LANGUAGE TypeApplications #-}
55
{-# LANGUAGE TypeFamilies #-}
66

7+
-- PlutusV2 must be compiled using plc 1.0
8+
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
9+
710
module Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop (script) where
811

912
import Language.Haskell.TH

0 commit comments

Comments
 (0)