on master help sign in
Get rid of profiling/

I have gotten a lot better at this based on this work though!

commit8f2c27875c9d70775f0105e8d8163ecf6dbd2d4a authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 21 Feb 2018, 17:35 (9 years ago) parentf66b008
3 files changed−97
profiling/Main.hs−77 profiling/cabal.config−2 profiling/elm-prof.cabal−18
profiling/Main.hsdeleted−77
@@ -1,77 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−module Main where
3−
4−import qualified Data.Attoparsec.Text as Atto
5−import qualified Data.IntMap as IntMap
6−import qualified Data.Text as Text
7−import qualified Data.Text.IO as Text
8−import qualified GHC.RTS.TimeAllocProfile as Prof
9−import qualified GHC.RTS.TimeAllocProfile.Types as Prof
10−import qualified Text.Tabular as Table
11−import qualified Text.Tabular.AsciiArt as Table
12−
13−
14−
15−main :: IO ()
16−main =
17− profToTable "elm-make.prof"
18−
19−
20−profToTable :: FilePath -> IO ()
21−profToTable filePath =
22− do text <- Text.readFile filePath
23− case Atto.parseOnly Prof.timeAllocProfile text of
24− Left err ->
25− putStrLn $ "Error parsing " ++ filePath ++ ": " ++ err
26−
27− Right profile ->
28− printTable (extractCostCentres profile)
29−
30−
31−
32−-- FILTER NAMED COST CENTRES
33−
34−
35−extractCostCentres :: Prof.TimeAllocProfile -> [Prof.CostCentre]
36−extractCostCentres profile =
37− let
38− nodes =
39− IntMap.elems (Prof.costCentreNodes (Prof.profileCostCentreTree profile))
40− in
41− filter (Text.isPrefixOf "elm_" . Prof.costCentreName) nodes
42−
43−
44−
45−-- CREATE A TABLE
46−
47−
48−printTable :: [Prof.CostCentre] -> IO ()
49−printTable costCentres =
50− let
51− rowHeaders =
52− Table.Group Table.NoLine $
53− map (Table.Header . Text.unpack . Prof.costCentreName) costCentres
54−
55− table =
56− Table.Table rowHeaders colHeaders (map toRow costCentres)
57− in
58− putStrLn (Table.render id id id table)
59−
60−
61−colHeaders :: Table.Header String
62−colHeaders =
63− Table.Group Table.NoLine
64− [ Table.Header " total time"
65− , Table.Header " local time"
66− , Table.Header " total alloc"
67− , Table.Header " local alloc"
68− ]
69−
70−
71−toRow :: Prof.CostCentre -> [String]
72−toRow costCentre =
73− [ show $ Prof.costCentreInhTime costCentre
74− , show $ Prof.costCentreIndTime costCentre
75− , show $ Prof.costCentreInhAlloc costCentre
76− , show $ Prof.costCentreIndAlloc costCentre
77− ]
profiling/cabal.configdeleted−2
@@ -1,2 +0,0 @@
1−library-profiling: True
2−executable-profiling: True
profiling/elm-prof.cabaldeleted−18
@@ -1,18 +0,0 @@
1−
2−Name: elm-prof
3−Version: 1.0.0
4−
5−Cabal-version: >=1.9
6−Build-type: Simple
7−
8−Executable elm-prof
9− Main-is:
10− Main.hs
11−
12− Build-depends:
13− attoparsec,
14− base >=4.2 && <5,
15− containers,
16− ghc-time-alloc-prof,
17− tabular,
18− text >= 1 && < 2