pretty print
This commit is contained in:
parent
15d58323a9
commit
7457c6334b
4 changed files with 34 additions and 30 deletions
|
|
@ -8,12 +8,12 @@ import Data.ByteString.Short qualified as SBS
|
|||
import Data.Csv (DefaultOrdered, ToNamedRecord, header, headerOrder, namedRecord, toNamedRecord, (.=))
|
||||
import Data.List (intercalate)
|
||||
import Data.Maybe (fromJust)
|
||||
import Data.Text (Text, pack)
|
||||
import Data.Text (Text, pack, unpack)
|
||||
import GHC.Generics (Generic)
|
||||
import Plutus.V1.Ledger.Api (
|
||||
ExBudget (ExBudget),
|
||||
ExCPU,
|
||||
ExMemory,
|
||||
ExCPU (..),
|
||||
ExMemory (..),
|
||||
Script,
|
||||
)
|
||||
import Plutus.V1.Ledger.Api qualified as Plutus
|
||||
|
|
@ -37,7 +37,11 @@ data Benchmark = Benchmark
|
|||
, scriptSize :: Int
|
||||
-- ^ The on-chain size of a script.
|
||||
}
|
||||
deriving stock (Show, Eq, Ord, Generic)
|
||||
deriving stock (Eq, Ord, Generic)
|
||||
|
||||
instance Show Benchmark where
|
||||
show (Benchmark name (ExCPU cpu) (ExMemory mem) size) =
|
||||
unpack name <> "\n\tCPU: " <> show cpu <> " MEM: " <> show mem <> " SIZE: " <> show size
|
||||
|
||||
instance ToNamedRecord Benchmark where
|
||||
toNamedRecord (Benchmark {..}) =
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ main = do
|
|||
I.writeFile "bench.csv" $
|
||||
(decodeUtf8 . encodeDefaultOrderedByName) res
|
||||
|
||||
mapM_ print res
|
||||
mapM_ (Prelude.putStrLn . (<> "\n") . show) res
|
||||
where
|
||||
res =
|
||||
specificationTreeToBenchmarks $
|
||||
group
|
||||
"Benchmark"
|
||||
"Agora"
|
||||
[ group
|
||||
"Effects"
|
||||
[ group "Treasury Withdrawal Effect" TreasuryWithdrawal.specs
|
||||
|
|
|
|||
|
|
@ -101,13 +101,13 @@ getSpecification :: String -> SpecificationTree -> [Specification]
|
|||
getSpecification name (Terminal spec@(Specification sn _ _))
|
||||
| name == sn = [spec]
|
||||
| otherwise = []
|
||||
getSpecification name (Group _ st) = mconcat $ (getSpecification name) <$> st
|
||||
getSpecification name (Group _ st) = mconcat $ getSpecification name <$> st
|
||||
|
||||
-- | Query specific @SpecificationTree@ from a tree.
|
||||
getSpecificationTree :: String -> SpecificationTree -> [SpecificationTree]
|
||||
getSpecificationTree name specTree@(Group gn st)
|
||||
| gn == name = [specTree]
|
||||
| otherwise = mconcat $ (getSpecificationTree name) <$> st
|
||||
| otherwise = mconcat $ getSpecificationTree name <$> st
|
||||
getSpecificationTree _ _ = []
|
||||
|
||||
-- | Convert @SpecificationTree@ into @TestTree@ to be used as a unit test.
|
||||
|
|
|
|||
44
bench.csv
44
bench.csv
|
|
@ -1,23 +1,23 @@
|
|||
name,cpu,mem,size
|
||||
Benchmark/Effects/Treasury Withdrawal Effect/effect/Simple,340268715,724428,3050
|
||||
Benchmark/Effects/Treasury Withdrawal Effect/effect/Simple with multiple treasuries ,570029812,1211300,3377
|
||||
Benchmark/Effects/Treasury Withdrawal Effect/effect/Mixed Assets,502351827,1071087,3242
|
||||
Benchmark/Effects/Governor Mutation Effect/validator/valid new governor datum/governor validator should pass,103054094,227264,7467
|
||||
Benchmark/Effects/Governor Mutation Effect/validator/valid new governor datum/effect validator should pass,126696096,263635,3293
|
||||
Benchmark/Stake/policy/stakeCreation,147898986,329450,2265
|
||||
Benchmark/Stake/validator/stakeDepositWithdraw deposit,261845190,576377,3829
|
||||
Benchmark/Stake/validator/stakeDepositWithdraw withdraw,261845190,576377,3821
|
||||
Benchmark/Proposal/policy/proposalCreation,34571405,70066,1549
|
||||
Benchmark/Proposal/validator/cosignature/proposal,242652509,511783,5247
|
||||
Benchmark/Proposal/validator/cosignature/stake,183513647,395070,4366
|
||||
Benchmark/Proposal/validator/voting/proposal,240358004,492704,5255
|
||||
Benchmark/Proposal/validator/voting/stake,154841851,329311,4419
|
||||
Benchmark/AuthorityToken/singleAuthorityTokenBurned/Correct simple,25177457,55883,806
|
||||
Benchmark/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,40266637,88241,900
|
||||
Benchmark/Treasury/Validator/Positive/Allows for effect changes,37343572,79744,1841
|
||||
Benchmark/AuthorityToken/singleAuthorityTokenBurned/Correct simple,25177457,55883,806
|
||||
Benchmark/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,40266637,88241,900
|
||||
Benchmark/Governor/policy/GST minting,57648280,119961,1836
|
||||
Benchmark/Governor/validator/proposal creation,309839049,649395,7994
|
||||
Benchmark/Governor/validator/GATs minting,429394828,928681,8113
|
||||
Benchmark/Governor/validator/mutate governor state,100243054,221538,7540
|
||||
Agora/Effects/Treasury Withdrawal Effect/effect/Simple,340268715,724428,3050
|
||||
Agora/Effects/Treasury Withdrawal Effect/effect/Simple with multiple treasuries ,570029812,1211300,3377
|
||||
Agora/Effects/Treasury Withdrawal Effect/effect/Mixed Assets,502351827,1071087,3242
|
||||
Agora/Effects/Governor Mutation Effect/validator/valid new governor datum/governor validator should pass,103054094,227264,7467
|
||||
Agora/Effects/Governor Mutation Effect/validator/valid new governor datum/effect validator should pass,126696096,263635,3293
|
||||
Agora/Stake/policy/stakeCreation,147898986,329450,2265
|
||||
Agora/Stake/validator/stakeDepositWithdraw deposit,261845190,576377,3829
|
||||
Agora/Stake/validator/stakeDepositWithdraw withdraw,261845190,576377,3821
|
||||
Agora/Proposal/policy/proposalCreation,34571405,70066,1549
|
||||
Agora/Proposal/validator/cosignature/proposal,242652509,511783,5247
|
||||
Agora/Proposal/validator/cosignature/stake,183513647,395070,4366
|
||||
Agora/Proposal/validator/voting/proposal,240358004,492704,5255
|
||||
Agora/Proposal/validator/voting/stake,154841851,329311,4419
|
||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,25177457,55883,806
|
||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,40266637,88241,900
|
||||
Agora/Treasury/Validator/Positive/Allows for effect changes,37343572,79744,1841
|
||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,25177457,55883,806
|
||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,40266637,88241,900
|
||||
Agora/Governor/policy/GST minting,57648280,119961,1836
|
||||
Agora/Governor/validator/proposal creation,309839049,649395,7994
|
||||
Agora/Governor/validator/GATs minting,429394828,928681,8113
|
||||
Agora/Governor/validator/mutate governor state,100243054,221538,7540
|
||||
|
|
|
|||
|
Loading…
Add table
Add a link
Reference in a new issue