From df3d0a999b40e62a694420ce7dea4a296998499a Mon Sep 17 00:00:00 2001 From: Alexander Diemand Date: Thu, 27 Sep 2018 12:05:07 +0200 Subject: [PATCH] [PB-95] independent 'post-mortem' tool Signed-off-by: Alexander Diemand --- pkgs/default.nix | 83 +++++++++++++ stack.yaml | 55 +++++---- tools/cardano-sl-tools.cabal | 91 --------------- tools/post-mortem/LICENSE | 20 ++++ tools/post-mortem/README.md | 5 + .../cardano-sl-tools-post-mortem.cabal | 110 ++++++++++++++++++ .../src}/JSONLog.hs | 0 .../post-mortem => post-mortem/src}/Main.hs | 0 .../src}/Options.hs | 0 .../src}/Statistics.hs | 0 .../src}/Statistics/Block.hs | 0 .../src}/Statistics/CSV.hs | 0 .../src}/Statistics/Chart.hs | 0 .../src}/Statistics/Focus.hs | 0 .../src}/Statistics/Graph.hs | 0 .../src}/Statistics/MemPool.hs | 0 .../src}/Statistics/Report.hs | 0 .../src}/Statistics/Throughput.hs | 0 .../src}/Statistics/Tx.hs | 0 .../post-mortem => post-mortem/src}/Types.hs | 0 .../src}/Util/Aeson.hs | 0 .../src}/Util/Pipes.hs | 0 .../src}/Util/Safe.hs | 0 23 files changed, 248 insertions(+), 116 deletions(-) create mode 100644 tools/post-mortem/LICENSE create mode 100644 tools/post-mortem/README.md create mode 100644 tools/post-mortem/cardano-sl-tools-post-mortem.cabal rename tools/{src/post-mortem => post-mortem/src}/JSONLog.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Main.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Options.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Block.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/CSV.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Chart.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Focus.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Graph.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/MemPool.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Report.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Throughput.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Statistics/Tx.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Types.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Util/Aeson.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Util/Pipes.hs (100%) rename tools/{src/post-mortem => post-mortem/src}/Util/Safe.hs (100%) diff --git a/pkgs/default.nix b/pkgs/default.nix index b98104c9b77..3c67a02b25c 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -17439,6 +17439,89 @@ doHaddock = false; description = "Cardano SL - Tools"; license = stdenv.lib.licenses.mit; +}) {}; +"cardano-sl-tools-post-mortem" = callPackage +({ + mkDerivation +, aeson +, attoparsec +, base +, bytestring +, cardano-sl +, cardano-sl-chain +, cardano-sl-core +, cardano-sl-infra +, cardano-sl-util +, cassava +, Chart +, Chart-diagrams +, containers +, directory +, fgl +, filepath +, foldl +, graphviz +, MonadRandom +, optparse-applicative +, pipes +, pipes-bytestring +, pipes-interleave +, pipes-safe +, process +, random +, stdenv +, text +, time-units +, universum +}: +mkDerivation { + +pname = "cardano-sl-tools-post-mortem"; +version = "1.3.0"; +src = ./../tools/post-mortem; +configureFlags = [ +"--ghc-option=-fwarn-redundant-constraints" +"--ghc-option=-Wall" +"--ghc-option=-Wcompat" +"--ghc-option=-Werror" +]; +isLibrary = false; +isExecutable = true; +executableHaskellDepends = [ +aeson +attoparsec +base +bytestring +cardano-sl +cardano-sl-chain +cardano-sl-core +cardano-sl-infra +cardano-sl-util +cassava +Chart +Chart-diagrams +containers +directory +fgl +filepath +foldl +graphviz +MonadRandom +optparse-applicative +pipes +pipes-bytestring +pipes-interleave +pipes-safe +process +random +text +time-units +universum +]; +doHaddock = false; +description = "Cardano SL - post-mortem tool"; +license = stdenv.lib.licenses.mit; + }) {}; "cardano-sl-util" = callPackage ({ diff --git a/stack.yaml b/stack.yaml index f1092b0608a..1dd7eab0ef0 100644 --- a/stack.yaml +++ b/stack.yaml @@ -33,6 +33,7 @@ packages: - explorer - node - tools +- tools/post-mortem - utxo - wallet - wallet/test @@ -294,33 +295,37 @@ extra-deps: - servant-swagger-ui-0.3.0.3.13.2 - servant-swagger-ui-redoc-0.3.0.1.21.2 +- fsnotify-0.2.1.2 +- hinotify-0.3.10 + # This is for CI to pass --fast to all dependencies apply-ghc-options: everything # If you find it too restrictive, you can use `scripts/build/cardano-sl.sh' script ghc-options: - cardano-sl: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-auxx: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-binary: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-binary-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-chain: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-chain-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-client: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-core: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-core-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-crypto: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-crypto-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-db: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-db-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-explorer: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-generator: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-infra: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-networking: -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-node: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-tools: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-util: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-util-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-wallet: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-wallet-new: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-node-ipc: -Wall -Werror -Wcompat -fwarn-redundant-constraints - cardano-sl-x509: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-auxx: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-binary: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-binary-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-chain: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-chain-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-client: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-core: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-core-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-crypto: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-crypto-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-db: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-db-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-explorer: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-generator: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-infra: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-networking: -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-node: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-tools: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-tools-post-mortem: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-util: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-util-test: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-wallet: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-wallet-new: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-node-ipc: -Wall -Werror -Wcompat -fwarn-redundant-constraints + cardano-sl-x509: -Wall -Werror -Wcompat -fwarn-redundant-constraints diff --git a/tools/cardano-sl-tools.cabal b/tools/cardano-sl-tools.cabal index f3f2fa8d840..841b4e46ece 100644 --- a/tools/cardano-sl-tools.cabal +++ b/tools/cardano-sl-tools.cabal @@ -23,12 +23,6 @@ Flag for-installer description: Build a reduced set of components (only what is needed for the installer) -Flag postmortem - default: False - manual: True - description: Build the post-mortem analysis tool (ignored if for-installer is - true) - executable dbgen hs-source-dirs: src/dbgen main-is: Main.hs @@ -328,91 +322,6 @@ executable cardano-cli-docs if flag(for-installer) buildable: False -executable cardano-post-mortem - hs-source-dirs: src/post-mortem - main-is: Main.hs - other-modules: JSONLog - , Options - , Statistics - , Statistics.Block - , Statistics.Chart - , Statistics.CSV - , Statistics.Focus - , Statistics.Graph - , Statistics.MemPool - , Statistics.Report - , Statistics.Throughput - , Statistics.Tx - , Types - , Util.Aeson - , Util.Pipes - , Util.Safe - if flag(postmortem) && !flag(for-installer) - buildable: True - build-depends: Chart - , Chart-diagrams - , MonadRandom - , aeson - , attoparsec - , base - , bytestring - , cardano-sl - , cardano-sl-chain - , cardano-sl-core - , cardano-sl-infra - , cardano-sl-chain - , cardano-sl-util - , containers - , cassava - , directory - , fgl - , filepath - , foldl - , graphviz - , optparse-applicative - , pipes - , pipes-bytestring - , pipes-interleave - , pipes-safe - , process - , random - , text - , time-units - , universum >= 0.1.11 - else - buildable: False - default-language: Haskell2010 - ghc-options: -threaded - -Wall - -O2 - -- linker speed up for linux - if os(linux) - ghc-options: -optl-fuse-ld=gold - ld-options: -fuse-ld=gold - - default-extensions: DeriveDataTypeable - DeriveGeneric - GeneralizedNewtypeDeriving - StandaloneDeriving - FlexibleContexts - FlexibleInstances - MultiParamTypeClasses - FunctionalDependencies - DefaultSignatures - NoImplicitPrelude - OverloadedStrings - TypeApplications - TupleSections - ViewPatterns - LambdaCase - MultiWayIf - ConstraintKinds - UndecidableInstances - ScopedTypeVariables - ScopedTypeVariables - BangPatterns - MonadFailDesugaring - executable cardano-blockchain-analyser hs-source-dirs: src/blockchain-analyser main-is: Main.hs diff --git a/tools/post-mortem/LICENSE b/tools/post-mortem/LICENSE new file mode 100644 index 00000000000..556402a1af7 --- /dev/null +++ b/tools/post-mortem/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2018 IOHK + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to +do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/tools/post-mortem/README.md b/tools/post-mortem/README.md new file mode 100644 index 00000000000..e9f66e505ed --- /dev/null +++ b/tools/post-mortem/README.md @@ -0,0 +1,5 @@ + +# cardano tool: post-mortem + +At the end of a benchmark run we launch `post-mortem` on the output JSON logs to summarize and analize the data of the run. + diff --git a/tools/post-mortem/cardano-sl-tools-post-mortem.cabal b/tools/post-mortem/cardano-sl-tools-post-mortem.cabal new file mode 100644 index 00000000000..1beefdd1602 --- /dev/null +++ b/tools/post-mortem/cardano-sl-tools-post-mortem.cabal @@ -0,0 +1,110 @@ +name: cardano-sl-tools-post-mortem +version: 1.3.0 +synopsis: Cardano SL - post-mortem tool +description: Cardano SL - post-mortem tool +license: MIT +license-file: LICENSE +author: IOHK +maintainer: operations@iohk.io +copyright: 2018 IOHK +category: Currency +build-type: Simple +extra-source-files: README.md +cabal-version: >=1.10 + +-- Note: for components that we don't want to build, we add both "buildable: +-- False" *and* wrap build-depends into "if !flag(for-installer)". This is +-- because stack doesn't seem to take "buildable: False" into account when +-- calculating the build plan. +Flag for-installer + default: False + manual: True + + description: Build a reduced set of components (only what is needed for the + installer) + +executable cardano-post-mortem + hs-source-dirs: src + main-is: Main.hs + other-modules: JSONLog + , Options + , Statistics + , Statistics.Block + , Statistics.Chart + , Statistics.CSV + , Statistics.Focus + , Statistics.Graph + , Statistics.MemPool + , Statistics.Report + , Statistics.Throughput + , Statistics.Tx + , Types + , Util.Aeson + , Util.Pipes + , Util.Safe + if !flag(for-installer) + buildable: True + build-depends: Chart + , Chart-diagrams + , MonadRandom + , aeson + , attoparsec + , base + , bytestring + , cardano-sl + , cardano-sl-chain + , cardano-sl-core + , cardano-sl-infra + , cardano-sl-chain + , cardano-sl-util + , containers + , cassava + , directory + , fgl + , filepath + , foldl + , graphviz + , optparse-applicative + , pipes + , pipes-bytestring + , pipes-interleave + , pipes-safe + , process + , random + , text + , time-units + , universum >= 0.1.11 + else + buildable: False + default-language: Haskell2010 + ghc-options: -threaded + -Wall + -O2 + -- linker speed up for linux + if os(linux) + ghc-options: -optl-fuse-ld=gold + ld-options: -fuse-ld=gold + + default-extensions: DeriveDataTypeable + DeriveGeneric + GeneralizedNewtypeDeriving + StandaloneDeriving + FlexibleContexts + FlexibleInstances + MultiParamTypeClasses + FunctionalDependencies + DefaultSignatures + NoImplicitPrelude + OverloadedStrings + TypeApplications + TupleSections + ViewPatterns + LambdaCase + MultiWayIf + ConstraintKinds + UndecidableInstances + ScopedTypeVariables + ScopedTypeVariables + BangPatterns + MonadFailDesugaring + diff --git a/tools/src/post-mortem/JSONLog.hs b/tools/post-mortem/src/JSONLog.hs similarity index 100% rename from tools/src/post-mortem/JSONLog.hs rename to tools/post-mortem/src/JSONLog.hs diff --git a/tools/src/post-mortem/Main.hs b/tools/post-mortem/src/Main.hs similarity index 100% rename from tools/src/post-mortem/Main.hs rename to tools/post-mortem/src/Main.hs diff --git a/tools/src/post-mortem/Options.hs b/tools/post-mortem/src/Options.hs similarity index 100% rename from tools/src/post-mortem/Options.hs rename to tools/post-mortem/src/Options.hs diff --git a/tools/src/post-mortem/Statistics.hs b/tools/post-mortem/src/Statistics.hs similarity index 100% rename from tools/src/post-mortem/Statistics.hs rename to tools/post-mortem/src/Statistics.hs diff --git a/tools/src/post-mortem/Statistics/Block.hs b/tools/post-mortem/src/Statistics/Block.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Block.hs rename to tools/post-mortem/src/Statistics/Block.hs diff --git a/tools/src/post-mortem/Statistics/CSV.hs b/tools/post-mortem/src/Statistics/CSV.hs similarity index 100% rename from tools/src/post-mortem/Statistics/CSV.hs rename to tools/post-mortem/src/Statistics/CSV.hs diff --git a/tools/src/post-mortem/Statistics/Chart.hs b/tools/post-mortem/src/Statistics/Chart.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Chart.hs rename to tools/post-mortem/src/Statistics/Chart.hs diff --git a/tools/src/post-mortem/Statistics/Focus.hs b/tools/post-mortem/src/Statistics/Focus.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Focus.hs rename to tools/post-mortem/src/Statistics/Focus.hs diff --git a/tools/src/post-mortem/Statistics/Graph.hs b/tools/post-mortem/src/Statistics/Graph.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Graph.hs rename to tools/post-mortem/src/Statistics/Graph.hs diff --git a/tools/src/post-mortem/Statistics/MemPool.hs b/tools/post-mortem/src/Statistics/MemPool.hs similarity index 100% rename from tools/src/post-mortem/Statistics/MemPool.hs rename to tools/post-mortem/src/Statistics/MemPool.hs diff --git a/tools/src/post-mortem/Statistics/Report.hs b/tools/post-mortem/src/Statistics/Report.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Report.hs rename to tools/post-mortem/src/Statistics/Report.hs diff --git a/tools/src/post-mortem/Statistics/Throughput.hs b/tools/post-mortem/src/Statistics/Throughput.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Throughput.hs rename to tools/post-mortem/src/Statistics/Throughput.hs diff --git a/tools/src/post-mortem/Statistics/Tx.hs b/tools/post-mortem/src/Statistics/Tx.hs similarity index 100% rename from tools/src/post-mortem/Statistics/Tx.hs rename to tools/post-mortem/src/Statistics/Tx.hs diff --git a/tools/src/post-mortem/Types.hs b/tools/post-mortem/src/Types.hs similarity index 100% rename from tools/src/post-mortem/Types.hs rename to tools/post-mortem/src/Types.hs diff --git a/tools/src/post-mortem/Util/Aeson.hs b/tools/post-mortem/src/Util/Aeson.hs similarity index 100% rename from tools/src/post-mortem/Util/Aeson.hs rename to tools/post-mortem/src/Util/Aeson.hs diff --git a/tools/src/post-mortem/Util/Pipes.hs b/tools/post-mortem/src/Util/Pipes.hs similarity index 100% rename from tools/src/post-mortem/Util/Pipes.hs rename to tools/post-mortem/src/Util/Pipes.hs diff --git a/tools/src/post-mortem/Util/Safe.hs b/tools/post-mortem/src/Util/Safe.hs similarity index 100% rename from tools/src/post-mortem/Util/Safe.hs rename to tools/post-mortem/src/Util/Safe.hs