From b05ae339bb152e4c2e7e8af5b26bc788292936e4 Mon Sep 17 00:00:00 2001 From: Noon van der Silk Date: Wed, 12 Feb 2025 09:39:52 +0000 Subject: [PATCH 1/4] Markdown table and headings --- hydra-cluster/bench/Bench/EndToEnd.hs | 16 ++++++++++------ hydra-cluster/bench/Bench/Summary.hs | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hydra-cluster/bench/Bench/EndToEnd.hs b/hydra-cluster/bench/Bench/EndToEnd.hs index ad5423b5d04..38a86f3d393 100644 --- a/hydra-cluster/bench/Bench/EndToEnd.hs +++ b/hydra-cluster/bench/Bench/EndToEnd.hs @@ -256,7 +256,11 @@ withOSStats workDir tvar action = Just _ -> withCreateProcess process{std_out = CreatePipe} $ \_stdin out _stderr _processHandle -> race - (collectStats tvar out) + ( do + -- Write the header + atomically $ writeTVar tvar [" | Time | Used | Free | ", "|------|------|------|"] + collectStats tvar out + ) action >>= \case Left _ -> failure "dstat process failed unexpectedly" @@ -277,13 +281,13 @@ withOSStats workDir tvar action = now <- getCurrentTime let str = pack $ - show now - <> "\n\t" - <> "Used: " + " | " + <> show now + <> " | " <> memUsed - <> ", " - <> "Free: " + <> " | " <> memFree + <> " | " stats <- readTVarIO tvar' atomically $ writeTVar tvar' $ stats <> [str] _ -> pure () diff --git a/hydra-cluster/bench/Bench/Summary.hs b/hydra-cluster/bench/Bench/Summary.hs index a3616293bc1..3d0b7bbcc81 100644 --- a/hydra-cluster/bench/Bench/Summary.hs +++ b/hydra-cluster/bench/Bench/Summary.hs @@ -69,7 +69,7 @@ textReport (Summary{totalTxs, numberOfTxs, averageConfirmationTime, quantiles, n else [] ) ++ ["Invalid txs: " <> show numberOfInvalidTxs] - ++ if null systemStats then [] else "\n| Memory data | \n" : [unlines systemStats] + ++ if null systemStats then [] else "\n## Memory data \n" : [unlines systemStats] markdownReport :: UTCTime -> [(Summary, SystemStats)] -> [Text] markdownReport now summaries = @@ -125,7 +125,7 @@ markdownReport now summaries = ++ [ "| _Number of Invalid txs_ | " <> show numberOfInvalidTxs <> " |" ] ++ [" "] - ++ if null systemStats then [] else "\n| Memory data | \n" : [unlines systemStats] + ++ if null systemStats then [] else "\n## Memory data \n" : [unlines systemStats] nominalDiffTimeToMilliseconds :: NominalDiffTime -> Nano nominalDiffTimeToMilliseconds = fromRational . (* 1000) . toRational . nominalDiffTimeToSeconds From 06acfd9c6e2b1dfb3d6389c388dd28634c9f81da Mon Sep 17 00:00:00 2001 From: Noon van der Silk Date: Wed, 12 Feb 2025 09:41:17 +0000 Subject: [PATCH 2/4] Formatting --- hydra-cluster/bench/Bench/EndToEnd.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hydra-cluster/bench/Bench/EndToEnd.hs b/hydra-cluster/bench/Bench/EndToEnd.hs index 38a86f3d393..f7987212109 100644 --- a/hydra-cluster/bench/Bench/EndToEnd.hs +++ b/hydra-cluster/bench/Bench/EndToEnd.hs @@ -257,9 +257,9 @@ withOSStats workDir tvar action = withCreateProcess process{std_out = CreatePipe} $ \_stdin out _stderr _processHandle -> race ( do - -- Write the header - atomically $ writeTVar tvar [" | Time | Used | Free | ", "|------|------|------|"] - collectStats tvar out + -- Write the header + atomically $ writeTVar tvar [" | Time | Used | Free | ", "|------|------|------|"] + collectStats tvar out ) action >>= \case From 7e5eaa1cc28c67ddca1cfc022812d0cbf27fd96c Mon Sep 17 00:00:00 2001 From: Noon van der Silk Date: Wed, 12 Feb 2025 09:57:56 +0000 Subject: [PATCH 3/4] Subsection; so is more indented --- hydra-cluster/bench/Bench/Summary.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hydra-cluster/bench/Bench/Summary.hs b/hydra-cluster/bench/Bench/Summary.hs index 3d0b7bbcc81..b69f5abb3eb 100644 --- a/hydra-cluster/bench/Bench/Summary.hs +++ b/hydra-cluster/bench/Bench/Summary.hs @@ -69,7 +69,7 @@ textReport (Summary{totalTxs, numberOfTxs, averageConfirmationTime, quantiles, n else [] ) ++ ["Invalid txs: " <> show numberOfInvalidTxs] - ++ if null systemStats then [] else "\n## Memory data \n" : [unlines systemStats] + ++ if null systemStats then [] else "\n### Memory data \n" : [unlines systemStats] markdownReport :: UTCTime -> [(Summary, SystemStats)] -> [Text] markdownReport now summaries = @@ -125,7 +125,7 @@ markdownReport now summaries = ++ [ "| _Number of Invalid txs_ | " <> show numberOfInvalidTxs <> " |" ] ++ [" "] - ++ if null systemStats then [] else "\n## Memory data \n" : [unlines systemStats] + ++ if null systemStats then [] else "\n### Memory data \n" : [unlines systemStats] nominalDiffTimeToMilliseconds :: NominalDiffTime -> Nano nominalDiffTimeToMilliseconds = fromRational . (* 1000) . toRational . nominalDiffTimeToSeconds From 30d4212fa5f535744668d0cd4a9fcab3683d4a08 Mon Sep 17 00:00:00 2001 From: Noon van der Silk Date: Wed, 12 Feb 2025 10:08:00 +0000 Subject: [PATCH 4/4] Update comment --- hydra-cluster/bench/Bench/EndToEnd.hs | 28 ++++++++++++--------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/hydra-cluster/bench/Bench/EndToEnd.hs b/hydra-cluster/bench/Bench/EndToEnd.hs index f7987212109..c4863ae7731 100644 --- a/hydra-cluster/bench/Bench/EndToEnd.hs +++ b/hydra-cluster/bench/Bench/EndToEnd.hs @@ -229,22 +229,18 @@ defaultDescription = "" -- Here is a sample content: -- -- @@ --- 2025-02-04 17:22:50.30543862 UTC --- Used: 7648M, Free: 46.9G --- 2025-02-04 17:22:55.305513945 UTC --- Used: 7713M, Free: 46.9G --- 2025-02-04 17:23:00.30550915 UTC --- Used: 7715M, Free: 46.9G --- 2025-02-04 17:23:05.305513574 UTC --- Used: 7717M, Free: 46.8G --- 2025-02-04 17:23:10.305538265 UTC --- Used: 7718M, Free: 46.8G --- 2025-02-04 17:23:15.305519942 UTC --- Used: 7719M, Free: 46.8G --- 2025-02-04 17:23:20.30550604 UTC --- Used: 7722M, Free: 46.8G --- 2025-02-04 17:23:25.305413146 UTC --- Used: 7723M, Free: 46.8G +-- | Time | Used | Free | +-- |------|------|------| +-- | 2025-02-12 09:45:53.585693506 UTC | 937M | 3731M | +-- | 2025-02-12 09:45:58.585773969 UTC | 1115M | 3553M | +-- | 2025-02-12 09:46:03.585779372 UTC | 1121M | 3546M | +-- | 2025-02-12 09:46:08.585751614 UTC | 1121M | 3545M | +-- | 2025-02-12 09:46:13.585925376 UTC | 1163M | 3435M | +-- | 2025-02-12 09:46:18.585811324 UTC | 1188M | 3334M | +-- | 2025-02-12 09:46:23.585786153 UTC | 1193M | 3328M | +-- | 2025-02-12 09:46:28.585797897 UTC | 1194M | 3327M | +-- | 2025-02-12 09:46:33.585771299 UTC | 1194M | 3326M | +-- | 2025-02-12 09:46:38.585774197 UTC | 1195M | 3325M | -- ... -- @@ --