ghc-stack-profiler-speedscope 0.2.0.0 → 0.3.0.0
raw patch · 4 files changed
+21/−30 lines, 4 filesdep ~ghc-stack-profiler-core
Dependency ranges changed: ghc-stack-profiler-core
Files
- CHANGELOG.md +5/−0
- ghc-stack-profiler-speedscope.cabal +3/−5
- src/GHC/Stack/Profiler/Speedscope.hs +12/−23
- src/GHC/Stack/Profiler/Speedscope/Types.hs +1/−2
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for ghc-stack-profiler-speedscope +## 0.3.0.0 -- 2026-06-23++* Support GHC 10.1 [#29](https://github.com/well-typed/ghc-stack-profiler/pull/29)+ * Adds supports for optional source locations in stack annotations+ ## 0.2.0.0 -- 2026-04-10 * Support ipedb to store InfoProvs [#8](https://github.com/well-typed/ghc-stack-profiler/pull/8)
ghc-stack-profiler-speedscope.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.8 name: ghc-stack-profiler-speedscope-version: 0.2.0.0+version: 0.3.0.0 license: BSD-3-Clause author: Hannes Siebenhandl, Wen Kokke, Matthew Pickering maintainer: hannes@well-typed.com@@ -14,9 +14,7 @@ extra-doc-files: CHANGELOG.md category: Profiling, Benchmarking, Development tested-with:- ghc ==9.10.3- ghc ==9.12.2- ghc ==9.14.1+ ghc ==10.1 || ==9.14.1 || ==9.12.2 || ==9.10.3 common warnings ghc-options:@@ -55,7 +53,7 @@ containers >=0.6.8 && <0.9, extra ^>=1.8.1, ghc-events ^>=0.20,- ghc-stack-profiler-core ==0.2.0.0,+ ghc-stack-profiler-core ==0.3.0.0, hs-speedscope ^>=0.3, ipedb ^>=0.1.0.0, machines ^>=0.7.4,
src/GHC/Stack/Profiler/Speedscope.hs view
@@ -186,19 +186,12 @@ mkCostCentreFrame :: UserCostCentre -> Frame mkCostCentreFrame = \ case- CostCentreMessage msg ->+ CostCentreMessage msg mloc -> Frame { name = msg- , file = Nothing- , col = Nothing- , line = Nothing- }- CostCentreSrcLoc loc ->- Frame- { name = functionName loc- , file = Just $ fileName loc- , col = Just $ word32ToInt $ ThreadSample.column loc- , line = Just $ word32ToInt $ ThreadSample.line loc+ , file = fileName <$> mloc+ , col = word32ToInt . ThreadSample.column <$> mloc+ , line = word32ToInt . ThreadSample.line <$> mloc } CostCentreIpe InfoProv{infoTableName, infoProvModule, infoProvLabel, infoProvSrcLoc} -> Frame@@ -406,15 +399,14 @@ -- -- Concrete example, assuming a stack @[1,2,3,4,5,6]@ and chunk size of 2: --- -- 1. Chunk it: @[1,2] [3,4] [5,6]@+ -- 1. Chunk it: @[6,5] [4,3] [2,1]@ -- 2. Write it to the eventlog in this order, so the messages are:- -- [1,2]- -- [3,4]- -- [5,6]+ -- [6,5]+ -- [4,3]+ -- [2,1] -- 3. When reading the eventlog, we store prepend later messages, resulting in:- -- [5,6] [3,4] [1,2]- -- 4. One reverse later: @[1,2] [3,4] [5,6]@- -- 5. Now we can finally concat the stack frame chunks.+ -- [2,1] [4,3] [6,5]+ -- 4. 'catCallStackMessage' reverses the individual callstack chunks to be the inverse of 'chunkCallStackMessage' orderedChunks = NonEmpty.reverse $ msg :| chunks fullBinaryCallStackMessage = catCallStackMessage orderedChunks (callStackMessage, errs) =@@ -437,11 +429,8 @@ Just prov -> lookupOrInsertCostCentre (CostCentreIpe prov) - ThreadSample.UserMessage msg ->- lookupOrInsertCostCentre (CostCentreMessage $ fromString msg)-- SourceLocation loc ->- lookupOrInsertCostCentre (CostCentreSrcLoc loc)+ UserAnnotation msg loc ->+ lookupOrInsertCostCentre (CostCentreMessage (fromString msg) loc) where lookupOrInsertCostCentre userMessage =
src/GHC/Stack/Profiler/Speedscope/Types.hs view
@@ -34,7 +34,6 @@ deriving (Eq, Ord, Show) data UserCostCentre- = CostCentreMessage !Text- | CostCentreSrcLoc !SourceLocation+ = CostCentreMessage !Text !(Maybe SourceLocation) | CostCentreIpe !InfoProv deriving (Eq, Ord, Show)