flamingra 0.1.1.1 → 0.2
raw patch · 4 files changed
+43/−15 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Flamingra/Docs.hs +4/−3
- Main.hs +36/−6
- changelog +2/−5
- flamingra.cabal +1/−1
Flamingra/Docs.hs view
@@ -1,13 +1,14 @@ -- |--- It will be (kind of) interactive (e.g. <http://lelf.lu/files/pandoc.svg>).+-- It will be (kind of) interactive (e.g. <http://lelf.lu/files/pandoc.svg>) -- . -- <<pandoc.svg>> -- -- = TL;DR (and the only one available) guide: -- -- > some-program +RTS -P--- > wget https://raw.githubusercontent.com/brendangregg/FlameGraph/master/flamegrph.pl--- > flamingra some-program.prof | perl flamegraph.pl > picturesque.svg+-- > wget https://github.com/brendangregg/FlameGraph/raw/master/flamegraph.pl+-- > chmod +x flamegraph.pl+-- > flamingra some-program.prof | ./flamegraph.pl > picturesque.svg -- -- = Usage: --
Main.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE RecordWildCards #-} module Main where import Text.Printf@@ -15,6 +16,16 @@ type State = ([String], Int) type Foldee = (State, Maybe String) +data CostCentre = CostCentre {+ ccLevel :: Int,+ ccName :: String,+ ccModule :: String,+ ccTicks :: Integer+ }++costCentreFormatFun :: CostCentre -> String+costCentreFormatFun cc = printf "%s:%s" (ccModule cc) (ccName cc)+ -- COST CENTRE ticks -- A … n₁ A n₁ -- B … n₂ ===> A;B n₂@@ -22,14 +33,33 @@ -- conv :: Foldee -> String -> Foldee conv (state@(stack,prevLevel),_) str- | length ws == 10 && ticks>0 = ((stack',level), Just $ printf "%s %d" (intercalate ";" stack') ticks)- | otherwise = (state, Nothing)- where + | Just cc@CostCentre{..} <- parseLine str,+ ccTicks > 0+ = let stack' = take (length stack - (prevLevel - ccLevel + 1)) stack <> [fun]+ fun = costCentreFormatFun cc+ in ((stack', ccLevel), Just $ printf "%s %d" (intercalate ";" stack') ccTicks)+ | otherwise+ = (state, Nothing)++++parseLine :: String -> Maybe CostCentre+parseLine str = costCentre <$> params+ where+ params | length ws == 10 = Just fields10+ | length ws == 11 = Just fields11+ | otherwise = Nothing++ costCentre (fun,mod,ticks) = CostCentre level fun mod (read ticks)+ ws = words str level = length . takeWhile (==' ') $ str- fun = printf "%s:%s" (ws!!1) (ws!!0)- ticks = read (ws!!8) :: Int- stack' = take (length stack - (prevLevel-level+1)) stack ++ [fun]++ fields11 = (fun,mod,ticks)+ where [fun,mod,_src,_no,_entries,_indTime,_indAlloc,_inhTime,_inhAlloc,ticks,_bytes] = ws+ fields10 = (fun,mod,ticks)+ where [fun,mod,_no,_entries,_indTime,_indAlloc,_inhTime,_inhAlloc,ticks,_bytes] = ws+ data Status = OK | PTooSmall deriving Show
changelog view
@@ -1,7 +1,4 @@-2015-04-19 Antonio Nikishaev <me@lelf.lu>-- * 0.1.1: Restrict deps+* 0.2 - * 0.1.1.1: Dear diary, FUCK haddock, I've simply moved docs to Flamingra.Docs;- ghc-7.10.1+Parse GHC-HEAD profiling reports too (new SRC field)
flamingra.cabal view
@@ -1,6 +1,6 @@ name: flamingra-version: 0.1.1.1+version: 0.2 synopsis: FlameGraphs of profiling description: Hack to turn the profiling output into the format suitable for FlameGraph. license: BSD3