From 5c0edf2f231a6aa9ba39ba6346e4880f7adb2ae0 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Fri, 27 Sep 2024 13:00:07 +0100 Subject: [PATCH 1/8] Fix render of heap profiles in -p mode Fixes #191 --- src/Eventlog/Data.hs | 4 ++-- src/Eventlog/Events.hs | 2 +- src/Eventlog/HeapProf.hs | 2 +- src/Eventlog/HtmlTemplate.hs | 14 +++++++++++--- src/Eventlog/Types.hs | 4 +++- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Eventlog/Data.hs b/src/Eventlog/Data.hs index 7ba02b5..3d58b83 100644 --- a/src/Eventlog/Data.hs +++ b/src/Eventlog/Data.hs @@ -40,11 +40,11 @@ generateJsonData a (ProfData h binfo ccMap fs traces heap_info ipes _ticky_count sortBy (flip (comparing (fst . snd))) $ Map.toList keeps -- Only supply the cost centre view in cost centre profiling mode. cc_descs = case hHeapProfileType h of - Just HeapProfBreakdownCostCentre -> Just (outputTree ccMap mdescs) + (FromEventlog (Just HeapProfBreakdownCostCentre)) -> Just (outputTree ccMap mdescs) _ -> Nothing use_ipes = case hHeapProfileType h of - Just HeapProfBreakdownInfoTable -> Just ipes + (FromEventlog (Just HeapProfBreakdownInfoTable)) -> Just ipes _ -> Nothing -- If we have IPE info, try to translate info table pointers to names diff --git a/src/Eventlog/Events.hs b/src/Eventlog/Events.hs index 9bc364e..b4c8561 100644 --- a/src/Eventlog/Events.hs +++ b/src/Eventlog/Events.hs @@ -344,7 +344,7 @@ elHeader EL{..} = let title = maybe "" T.unwords pargs date = formatDate clocktimeSec ppSamplingRate = T.pack . maybe "" (show . fromNano) $ samplingRate - in \v -> Header title date heapProfileType ppSamplingRate "" "" v (T.unpack . head <$> pargs) + in \v -> Header title date (FromEventlog heapProfileType) ppSamplingRate "" "" v (T.unpack . head <$> pargs) elBucketMap :: EL -> BucketMap diff --git a/src/Eventlog/HeapProf.hs b/src/Eventlog/HeapProf.hs index 1ac6028..354a728 100644 --- a/src/Eventlog/HeapProf.hs +++ b/src/Eventlog/HeapProf.hs @@ -27,7 +27,7 @@ chunkT s = [job, date, smpU, valU] = zipWith header [sJOB, sDATE, sSAMPLE_UNIT, sVALUE_UNIT] hs fs = chunkSamples ss - in (\v -> Header job date Nothing (pack "") smpU valU v Nothing + in (\v -> Header job date FromHPFile (pack "") smpU valU v Nothing , fs ) diff --git a/src/Eventlog/HtmlTemplate.hs b/src/Eventlog/HtmlTemplate.hs index fe174d0..adac8a4 100644 --- a/src/Eventlog/HtmlTemplate.hs +++ b/src/Eventlog/HtmlTemplate.hs @@ -19,7 +19,7 @@ import Data.FileEmbed import Eventlog.Data import Eventlog.Javascript import Eventlog.Args -import Eventlog.Types (Header(..), HeapProfBreakdown(..)) +import Eventlog.Types (Header(..), HeapProfBreakdown(..), ProfileType(..)) import Eventlog.Rendering.Bootstrap import Eventlog.Rendering.Types import Eventlog.VegaTemplate @@ -162,11 +162,15 @@ perTabFooter :: Header -> Html perTabFooter header' = do H.div ! class_ "row" $ do H.div ! class_ "col" $ do - toHtml $ maybe "No heap profile" ppHeapProfileType (hHeapProfileType header') + toHtml $ render_type (hHeapProfileType header') ", created at " code $ toHtml $ hDate header' " by " code $ toHtml $ hJob header' + where + render_type FromHPFile = "heap profile" + render_type (FromEventlog Nothing) = "No heap profile" + render_type (FromEventlog (Just t)) = ppHeapProfileType t select_data :: IncludeTraceData -> ChartType -> [Text] @@ -248,7 +252,11 @@ metaTab header' _as = " seconds between heap samples" has_heap_profile :: Header -> Bool -has_heap_profile h = isJust (hHeapProfileType h) +has_heap_profile h = + case (hHeapProfileType h) of + FromHPFile -> True + FromEventlog t -> isJust t + allHeapTabs :: Header -> Args -> HeapProfileData -> [TabGroup] allHeapTabs header' as x = diff --git a/src/Eventlog/Types.hs b/src/Eventlog/Types.hs index 456e718..4c22c8f 100644 --- a/src/Eventlog/Types.hs +++ b/src/Eventlog/Types.hs @@ -19,7 +19,7 @@ data Header = Header { hJob :: Text , hDate :: Text - , hHeapProfileType :: Maybe HeapProfBreakdown + , hHeapProfileType :: ProfileType , hSamplingRate :: Text , hSampleUnit :: Text , hValueUnit :: Text @@ -27,6 +27,8 @@ data Header = , hProgPath :: Maybe FilePath } deriving Show +data ProfileType = FromHPFile | FromEventlog (Maybe HeapProfBreakdown) deriving Show + -- The bucket is a key to uniquely identify a band newtype Bucket = Bucket Text From daf3b025c8fbdaa1cae76270d9bb765fa8baad37 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 11:19:38 +0100 Subject: [PATCH 2/8] Add support for eras profiling --- eventlog2html.cabal | 2 +- src/Eventlog/HtmlTemplate.hs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/eventlog2html.cabal b/eventlog2html.cabal index ac0ba79..8c6ded5 100644 --- a/eventlog2html.cabal +++ b/eventlog2html.cabal @@ -46,7 +46,7 @@ Library containers >= 0.5.0 && < 0.8, file-embed >= 0.0.11 && < 0.1, filepath >= 1.4.2 && < 1.6, - ghc-events >= 0.19.0 && < 0.21, + ghc-events >= 0.20.0 && < 0.21, ghc-heap >= 9 && < 10, hashable >= 1.0 && < 1.6, hashtables >= 1.2.3 && < 1.5, diff --git a/src/Eventlog/HtmlTemplate.hs b/src/Eventlog/HtmlTemplate.hs index adac8a4..4f49387 100644 --- a/src/Eventlog/HtmlTemplate.hs +++ b/src/Eventlog/HtmlTemplate.hs @@ -227,6 +227,7 @@ ppHeapProfileType (HeapProfBreakdownRetainer) = "Retainer profiling (implied by ppHeapProfileType (HeapProfBreakdownBiography) = "Biographical profiling (implied by -hb)" ppHeapProfileType (HeapProfBreakdownClosureType) = "Basic heap profile (implied by -hT)" ppHeapProfileType (HeapProfBreakdownInfoTable) = "Info table profile (implied by -hi)" +ppHeapProfileType (HeapProfBreakdownEra) = "Era profile (implied by -he)" allTabs :: EventlogType From 8dbb3d0e6643b46e5261761cf6e367677297600c Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 11:23:03 +0100 Subject: [PATCH 3/8] Update GHC versions in CI --- .github/workflows/ghc-matrix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ghc-matrix.yml b/.github/workflows/ghc-matrix.yml index 1d19024..5e1659d 100644 --- a/.github/workflows/ghc-matrix.yml +++ b/.github/workflows/ghc-matrix.yml @@ -16,13 +16,13 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - ghc-version: ['9.0.2', '9.2.7', '9.4.7', '9.6.2', '9.8.1', '9.10.1'] + ghc-version: ['9.6.7', '9.8.4', '9.10.2', '9.12.2'] include: - os: windows-latest - ghc-version: '9.6.2' + ghc-version: '9.12.2' - os: macos-latest - ghc-version: '9.6.2' + ghc-version: '9.12.2' steps: - uses: actions/checkout@v4 From cc34a35186df55bfa76f8b36144f75f622ef4481 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 11:48:54 +0100 Subject: [PATCH 4/8] Update nix code --- default.nix | 4 ++-- nix/sources.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index d0ffd51..0e2563d 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -{ci ? false, haskellCompiler ? "ghc927" }: +{ci ? false, haskellCompiler ? "ghc9102" }: let # Import the Haskell.nix library, haskell-src = import ((import ./nix/sources.nix)."haskell.nix") {}; @@ -17,7 +17,7 @@ let compiler-nix-name = haskellCompiler; src = haskell.haskellLib.cleanGit { name = "eventlog2html"; src = ./.; }; modules = (if ci then ciOptions else []) ++ opts; - index-state = "2023-03-25T00:00:00Z"; + index-state = "2025-06-01T00:00:00Z"; }; diff --git a/nix/sources.json b/nix/sources.json index 6b7f2c3..8bba503 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "https://input-output-hk.github.io/haskell.nix", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "af82dc3e464f58f5cc90400200f703e197d52e84", - "sha256": "0cdbxwqd8d22dxnqx6d1060hpjk5awwp4z5v5lvavp3p8fngg9cv", + "rev": "60bd09012b12681434a27ab04617ad5b1cfa4650", + "sha256": "1b4pqsfrfnyxdn1zm7jm3c6drn83xg4xq7676j2iffjpz21njcvq", "type": "tarball", - "url": "https://github.com/input-output-hk/haskell.nix/archive/af82dc3e464f58f5cc90400200f703e197d52e84.tar.gz", + "url": "https://github.com/input-output-hk/haskell.nix/archive/60bd09012b12681434a27ab04617ad5b1cfa4650.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": { From 01a8a2141a662763ae27123ee72982e8812251bb Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 11:52:47 +0100 Subject: [PATCH 5/8] Update CI caches --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e9e719b..d20c5bf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: name: mpickering signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - run: cachix push mpickering --watch-store& - - run: nix-build -A eventlog2html --arg ci true --argstr haskellCompiler ghc927 --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" --option substituters "https://cache.iog.io https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ https://mpickering.cachix.org" + - run: nix-build -A eventlog2html --arg ci true --argstr haskellCompiler ghc9102 --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" --option substituters "https://cache.iog.io https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ https://mpickering.cachix.org" deploy: runs-on: ubuntu-latest steps: @@ -44,7 +44,7 @@ jobs: name: mpickering signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - run: cachix push mpickering --watch-store& - - run: nix-build -A site --arg ci true -o site --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option substituters "https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ https://mpickering.cachix.org" + - run: nix-build -A site --arg ci true -o site --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option substituters "https://cache.iog.io https://cache.nixos.org/ https://mpickering.cachix.org" # This stuff is only to avoid the deployment crashing when it # tries to remove files - run: mkdir -p build-folder From 075b3ff90d230c0b9400d6f29657aa24b2c515cd Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 11:54:53 +0100 Subject: [PATCH 6/8] LFS cache --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d20c5bf..99b10ab 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,7 +28,7 @@ jobs: run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id - name: Restore LFS cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: lfs-cache with: path: .git/lfs From 825e77a6ccf327fe74d60dca6334d28ce939da34 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 11:56:29 +0100 Subject: [PATCH 7/8] Caches --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 99b10ab..1a1f777 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: name: mpickering signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - run: cachix push mpickering --watch-store& - - run: nix-build -A eventlog2html --arg ci true --argstr haskellCompiler ghc9102 --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" --option substituters "https://cache.iog.io https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ https://mpickering.cachix.org" + - run: nix-build -A eventlog2html --arg ci true --argstr haskellCompiler ghc9102 --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" --option substituters "https://cache.iog.io https://cache.nixos.org/ https://mpickering.cachix.org" deploy: runs-on: ubuntu-latest steps: From 99f1012af3e00459116eff4774359fb3bd982a07 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 3 Jun 2025 12:01:45 +0100 Subject: [PATCH 8/8] No -Werror --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 0e2563d..6227d6b 100644 --- a/default.nix +++ b/default.nix @@ -8,7 +8,7 @@ let haskell = pin.haskell-nix; - ciOptions = [ { packages.eventlog2html.configureFlags = [ "--ghc-option=-Werror" ]; } ]; + ciOptions = []; # [ { packages.eventlog2html.configureFlags = [ "--ghc-option=-Werror" ]; } ]; opts = [ { packages.vault.doHaddock = false; } ];