Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: add PlutusV3 RIPEMD-160 benchmarks; workbench maintenance #6032

Merged
merged 8 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ Changelogs for components can be found as follows:
- [cardano-tracer](https://github.com/IntersectMBO/cardano-node/blob/master/cardano-tracer/CHANGELOG.md)
- [cardano-node-capi](https://github.com/IntersectMBO/cardano-node/blob/master/cardano-node-capi/CHANGELOG.md)
- [bench/tx-generator](https://github.com/IntersectMBO/cardano-node/blob/master/bench/tx-generator/CHANGELOG.md)
- [bench/trace-analyzer](https://github.com/IntersectMBO/cardano-node/blob/master/bench/trace-analyzer/CHANGELOG.md)

49 changes: 45 additions & 4 deletions bench/cardano-profile/app/cardano-profile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
--------------------------------------------------------------------------------

import Prelude

import Data.Function ((&))
import System.Environment (lookupEnv)
-- Package: aeson.
import qualified Data.Aeson as Aeson
-- Package: aeson-pretty
import Data.Aeson.Encode.Pretty as Aeson
-- Package: bytestring.
import qualified Data.ByteString.Lazy.Char8 as BSL8
-- Package: optparse-applicative-fork.
import qualified Options.Applicative as OA
-- Package: self.
import qualified Cardano.Benchmarking.Profile as Profiles
import qualified Cardano.Benchmarking.Profile.NodeSpecs as NodeSpecs
import qualified Cardano.Benchmarking.Profile.Types as Types

--------------------------------------------------------------------------------
Expand All @@ -20,11 +25,16 @@ data Cli =
Names
| NamesCloudNoEra
| All
| ByName String
| ByName PrettyPrint String
| LibMK
| NodeSpecs FilePath FilePath
| ToJson String
| FromJson String

data PrettyPrint =
PrettyPrint
| SingleLine

--------------------------------------------------------------------------------

main :: IO ()
Expand All @@ -40,15 +50,31 @@ main = do
obj <- lookupOverlay
BSL8.putStrLn $ Aeson.encode $ Profiles.profiles obj
-- Print a single profiles, with an optional overlay.
(ByName profileName) -> do
(ByName prettyPrint profileName) -> do
obj <- lookupOverlay
case Profiles.byName profileName obj of
Nothing -> error $ "No profile named \"" ++ profileName ++ "\""
(Just profile) ->
let aeson = Aeson.encode profile
let
prettyConf = defConfig { confCompare = compare, confTrailingNewline = True }
aeson = profile & case prettyPrint of
PrettyPrint -> Aeson.encodePretty' prettyConf
SingleLine -> Aeson.encode
in BSL8.putStrLn aeson
LibMK -> do
mapM_ putStrLn Profiles.libMk
(NodeSpecs profilePath topologyPath) -> do
eitherProfile <- Aeson.eitherDecodeFileStrict profilePath
let profile = case eitherProfile of
(Left errorMsg) ->
error $ "Not a valid profile: " ++ errorMsg
(Right value) -> value
eitherTopology <- Aeson.eitherDecodeFileStrict topologyPath
let topology = case eitherTopology of
(Left errorMsg) ->
error $ "Not a valid topology: " ++ errorMsg
(Right value) -> value
BSL8.putStrLn $ Aeson.encode $ NodeSpecs.nodeSpecs profile topology
-- Print a single profiles, with an optional overlay.
(ToJson filePath) -> print filePath
-- str <- readFile filePath
Expand Down Expand Up @@ -100,15 +126,30 @@ cliParser = OA.hsubparser $
<>
OA.command "by-name"
(OA.info
(ByName <$> OA.argument OA.str (OA.metavar "PROFILE-NAME"))
(ByName SingleLine <$> OA.argument OA.str (OA.metavar "PROFILE-NAME"))
(OA.fullDesc <> OA.header "by-name" <> OA.progDesc "Create profile")
)
<>
OA.command "by-name-pretty"
(OA.info
(ByName PrettyPrint <$> OA.argument OA.str (OA.metavar "PROFILE-NAME"))
(OA.fullDesc <> OA.header "by-name-pretty" <> OA.progDesc "Create profile (pretty-printed)")
)
<>
OA.command "lib-make"
(OA.info
(pure LibMK)
(OA.fullDesc <> OA.header "lib-make" <> OA.progDesc "Makefile include")
)
<>
OA.command "node-specs"
(OA.info
( NodeSpecs
<$> OA.argument OA.str (OA.metavar "PROFILE-JSON-FILEPATH" )
<*> OA.argument OA.str (OA.metavar "TOPOLOGY-JSON-FILEPATH")
)
(OA.fullDesc <> OA.header "node-specs" <> OA.progDesc "Create the profile's node-specs.json file")
)
<>
OA.command "to-json"
(OA.info
Expand Down
14 changes: 12 additions & 2 deletions bench/cardano-profile/cardano-profile.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: cardano-profile
version: 8.6.0
version: 8.7.0
synopsis: A Cardano benchmarking profile generator
description: A Cardano benchmarking profile generator.
category: Cardano,
Expand All @@ -17,6 +17,12 @@ data-files: data/all-profiles.json
data/ci-test-bage.json
data/genesis/epoch-timeline.json
data/genesis/overlays/*.json
data/test/default-coay/*.json
data/test/chainsync-early-alonzo-coay/*.json
data/test/chainsync-early-byron-coay/*.json
data/test/ci-test-coay/*.json
data/test/ci-test-dense10-coay/*.json
data/test/fast-nomadperf-coay/*.json

common project-config
build-depends: base >= 4.14 && < 5
Expand All @@ -37,6 +43,7 @@ library
other-modules: Paths_cardano_profile
autogen-modules: Paths_cardano_profile
exposed-modules: Cardano.Benchmarking.Profile
-- Profile definitions.
, Cardano.Benchmarking.Profile.Builtin.Cloud
, Cardano.Benchmarking.Profile.Builtin.Empty
, Cardano.Benchmarking.Profile.Builtin.ForgeStress
Expand All @@ -52,6 +59,7 @@ library
, Cardano.Benchmarking.Profile.Builtin.Scenario.Idle
, Cardano.Benchmarking.Profile.Builtin.Scenario.TracerOnly
, Cardano.Benchmarking.Profile.Extra.Scaling
, Cardano.Benchmarking.Profile.NodeSpecs
, Cardano.Benchmarking.Profile.Primitives
, Cardano.Benchmarking.Profile.Vocabulary
, Cardano.Benchmarking.Profile.Types
Expand All @@ -70,6 +78,7 @@ executable cardano-profile
hs-source-dirs: app/
main-is: cardano-profile.hs
build-depends: aeson
, aeson-pretty
, vector
, bytestring
, optparse-applicative-fork
Expand All @@ -81,7 +90,8 @@ test-suite cardano-profile-test
hs-source-dirs: test/
main-is: Main.hs
type: exitcode-stdio-1.0
other-modules: Paths_cardano_profile
other-modules: Cardano.Benchmarking.Profile.NodeSpecs.Tests
, Paths_cardano_profile
autogen-modules: Paths_cardano_profile
build-depends: base
, aeson
Expand Down
469,377 changes: 469,376 additions & 1 deletion bench/cardano-profile/data/all-profiles.json

Large diffs are not rendered by default.

Loading
Loading