From c397e18f35fcd36c0988bfef41b3fd0d8f2a3d3f Mon Sep 17 00:00:00 2001 From: Adam Sandberg Ericsson Date: Tue, 4 Oct 2022 11:08:29 +0100 Subject: [PATCH 1/2] update flamegraph with latest master --- FlameGraph | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlameGraph b/FlameGraph index a8d807a..d9fcc27 160000 --- a/FlameGraph +++ b/FlameGraph @@ -1 +1 @@ -Subproject commit a8d807a11c0f22871134324bda709618ca482b58 +Subproject commit d9fcc272b6a08c3e3e5b7919040f0ab5f8952d65 From 97cfb73c9e2641ccf85267a6dbe8f0568b35bafc Mon Sep 17 00:00:00 2001 From: Adam Sandberg Ericsson Date: Tue, 4 Oct 2022 11:14:42 +0100 Subject: [PATCH 2/2] set a default sensible title for the flamegraph based on the report type --- ghc-prof-flamegraph.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ghc-prof-flamegraph.hs b/ghc-prof-flamegraph.hs index 2f9bef8..f10f9fa 100644 --- a/ghc-prof-flamegraph.hs +++ b/ghc-prof-flamegraph.hs @@ -31,6 +31,14 @@ data ReportType = Alloc -- ^ Report allocations, percent | Bytes -- ^ Report bytes allocated, number deriving (Eq, Show) +reportTypeFlags :: ReportType -> [String] +reportTypeFlags typ = case typ of + Alloc -> ["--title", "Allocations (%)", "--countname", "%"] + Bytes -> ["--title", "Allocations (bytes)", "--countname", "B"] + Entries -> ["--title", "Entries (count)"] + Time -> ["--title", "Time (%)", "--countname", "%"] + Ticks -> ["--title", "Time (ticks)"] + optionsParser :: Opts.Parser Options optionsParser = Options <$> (Opts.flag' Alloc (Opts.long "alloc" <> Opts.help "Uses the allocation measurements instead of time measurements") @@ -119,7 +127,8 @@ main = do Nothing -> do dataDir <- getDataDir let flamegraphPath = dataDir "FlameGraph" "flamegraph.pl" - flamegraphProc = (proc "perl" (flamegraphPath : optionsFlamegraphFlags options)) + flamgegraphArgs = reportTypeFlags (optionsReportType options) ++ optionsFlamegraphFlags options + flamegraphProc = (proc "perl" (flamegraphPath : flamgegraphArgs)) { std_in = CreatePipe , std_out = CreatePipe , std_err = Inherit