mirror of
https://github.com/qnikst/ghc-timings-report.git
synced 2024-10-03 23:39:35 +03:00
Remove extra spaces.
This commit is contained in:
parent
01aa2431e1
commit
b4c7f9844b
@ -30,11 +30,11 @@ cabal v2-build
|
||||
```
|
||||
|
||||
At this point I don't suggest you to install the tool because
|
||||
at such an early stage it will likely require manual configuration
|
||||
at such an early stage it will likely require manual configuration
|
||||
a lot.
|
||||
|
||||
3. Configure your project in order to generate timing files:
|
||||
|
||||
|
||||
```bash
|
||||
cabal v2-configure --ghc-options=-ddump-timings --ghc-options=-ddump-to-file
|
||||
```
|
||||
|
@ -19,5 +19,5 @@ set grid y
|
||||
set style data lines
|
||||
plot '<INPUT_FILE>' using ($0-0.2):3 index 0 with boxes title "before", \
|
||||
'' using ($0+0.2):4 index 0 with boxes title "after", \
|
||||
'' using ($0):xtic(1) lw 0 notitle
|
||||
'' using ($0):xtic(1) lw 0 notitle
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
set datafile separator "\t"
|
||||
set terminal svg size 8000,4000
|
||||
set output '<OUTPUT_FILE>'
|
||||
set output '<OUTPUT_FILE>'
|
||||
set datafile missing ""
|
||||
|
||||
set xlabel "ms"
|
||||
|
@ -22,7 +22,7 @@ import qualified Data.Map.Strict as Map
|
||||
import qualified Data.Text.IO as T
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Vector as V
|
||||
import qualified Data.Vector.Mutable as V (write)
|
||||
import qualified Data.Vector.Mutable as V (write)
|
||||
import qualified Prelude
|
||||
|
||||
import GhcBuildPhase
|
||||
@ -51,7 +51,7 @@ runCompare beforeDir afterDir out = do
|
||||
withCurrentDirectory out $ do
|
||||
renderModules mergedModulesData
|
||||
renderPackage mergedModulesData
|
||||
|
||||
|
||||
-- ** Helpers for `compare`
|
||||
|
||||
checkDirectoriesExistence :: FilePath -> FilePath -> IO ()
|
||||
@ -144,7 +144,7 @@ mergeModulesReports modulesBefore modulesAfter =
|
||||
}
|
||||
where
|
||||
ix = moduleMap Map.! name
|
||||
|
||||
|
||||
in List.foldl' update vec bs
|
||||
go vec [] as
|
||||
= let update v (moduleName, moduleData)
|
||||
@ -160,7 +160,7 @@ mergeModulesReports modulesBefore modulesAfter =
|
||||
ix = moduleMap Map.! name
|
||||
in List.foldl' update vec as
|
||||
go vec oldB@(b : bs) oldA@(a : as) = case fst b `compare` fst a of
|
||||
EQ -> let update v moduleName moduleDataBefore moduleDataAfter
|
||||
EQ -> let update v moduleName moduleDataBefore moduleDataAfter
|
||||
= V.modify
|
||||
(modifier moduleName moduleDataBefore moduleDataAfter)
|
||||
v
|
||||
@ -174,7 +174,7 @@ mergeModulesReports modulesBefore modulesAfter =
|
||||
where
|
||||
ix = moduleMap Map.! name
|
||||
in go (update vec (fst b) (snd b) (snd a)) bs as
|
||||
LT -> let update v make (moduleName, moduleData)
|
||||
LT -> let update v make (moduleName, moduleData)
|
||||
= V.modify (modifier make moduleName moduleData) v
|
||||
modifier make name data' v
|
||||
= V.write v ix
|
||||
@ -186,7 +186,7 @@ mergeModulesReports modulesBefore modulesAfter =
|
||||
where
|
||||
ix = moduleMap Map.! name
|
||||
in go (update vec makeBefore b) bs oldA
|
||||
GT -> let update v make (moduleName, moduleData)
|
||||
GT -> let update v make (moduleName, moduleData)
|
||||
= V.modify (modifier make moduleName moduleData) v
|
||||
modifier make name data' v
|
||||
= V.write v ix
|
||||
@ -388,7 +388,7 @@ renderModules rows = do
|
||||
removeFile "module.template.gnuplot"
|
||||
where
|
||||
opts = Csv.defaultEncodeOptions { Csv.encDelimiter = fromIntegral (ord '\t') }
|
||||
renderRow row =
|
||||
renderRow row =
|
||||
let content = mconcat
|
||||
(Prelude.map (Csv.encodeRecordWith opts)
|
||||
[ ( phaseReportPhaseName pr
|
||||
|
@ -66,7 +66,7 @@ runGenerate dir = do
|
||||
Prelude.putStrLn "Warning, some files are failed to be parsed"
|
||||
Prelude.print files_failed
|
||||
|
||||
|
||||
|
||||
-- Output all files in json form for later analysis.
|
||||
results <- for files_parsed $ \f -> do
|
||||
steps <- fmap parsePhases $ T.readFile (rebuildFilePath f)
|
||||
@ -84,7 +84,7 @@ runGenerate dir = do
|
||||
-- FIXME: put this file back later
|
||||
-- encodeFile (output </> "stats_by_package" <.> "json") stats_by_package
|
||||
for_ (Map.toList stats_by_package) $ \(package, stat) -> do
|
||||
let headers = Set.toList $ Set.fromList
|
||||
let headers = Set.toList $ Set.fromList
|
||||
[ phaseName
|
||||
| (_, steps) <- Map.toList stat
|
||||
, Phase{..} <- steps
|
||||
@ -94,7 +94,7 @@ runGenerate dir = do
|
||||
, Prelude.map (\n -> Map.lookup n by_phase) headers)
|
||||
| (GhcFile{..}, steps) <- Map.toList stat
|
||||
, let total = Prelude.sum [phaseTime | Phase{..} <- steps]
|
||||
, let by_phase = Map.fromListWith (+)
|
||||
, let by_phase = Map.fromListWith (+)
|
||||
[ (phaseName, phaseTime)
|
||||
| Phase{..} <- steps
|
||||
]
|
||||
@ -103,7 +103,7 @@ runGenerate dir = do
|
||||
mkHtmlFile ("./tmp/" <> package <> ".html")
|
||||
$ Report.packageTable package headers rows
|
||||
let bs = Csv.encodeHeader (V.fromList ("module": "total": Prelude.map T.encodeUtf8 headers))
|
||||
<> mconcat (Prelude.map Csv.encodeRecord
|
||||
<> mconcat (Prelude.map Csv.encodeRecord
|
||||
[ Prelude.map T.encodeUtf8 $ T.pack (joinPath modulePath):(showt total):Prelude.map showt cols
|
||||
| (GhcFile{..}, total, cols) <- rows
|
||||
])
|
||||
@ -133,6 +133,6 @@ findDumpTimings input = do
|
||||
mkHtmlFile :: FilePath -> Markup -> IO ()
|
||||
mkHtmlFile fn markup = do
|
||||
B.writeFile fn "" -- TODO: properly cleanup the file
|
||||
renderMarkupToByteStringIO
|
||||
renderMarkupToByteStringIO
|
||||
(B.appendFile fn) -- TODO: keep handle opened instead of reopening each time.
|
||||
markup
|
||||
|
Loading…
Reference in New Issue
Block a user