1
0
forked from GitHub/gf-core

Add memory stats to benchmark

This commit is contained in:
John J. Camilleri
2021-02-17 15:02:39 +01:00
parent b4fce5db59
commit 8e1fa4981f
2 changed files with 10 additions and 3 deletions

View File

@@ -28,7 +28,8 @@ Comparing PGF, PGF2, LPGF along following criteria:
### Running
```
stack build --test --bench --no-run-tests --no-run-benchmarks && time stack bench
stack build --test --bench --no-run-tests --no-run-benchmarks && time PGF_ONLY=1 stack bench
stack build --test --bench --no-run-tests --no-run-benchmarks && time LPGF_ONLY=1 stack bench
stack build --test --bench --no-run-tests --no-run-benchmarks
stack bench --benchmark-arguments "+RTS -T -RTS"
PGF_ONLY=1 stack bench --benchmark-arguments "+RTS -T -RTS"
LPGF_ONLY=1 stack bench --benchmark-arguments "+RTS -T -RTS"
```

View File

@@ -19,6 +19,8 @@ import System.Environment (lookupEnv)
import System.FilePath ((</>), takeBaseName, takeExtension)
import Text.Printf (printf)
import GHC.Stats
dir :: FilePath
dir = "testsuite" </> "lpgf"
@@ -61,6 +63,10 @@ main = do
time "linearise LPGF" (return $ length $ linLPGF lpgf trees)
return ()
stats <- getRTSStats
printf "Max live memory: %s\n" (convertSize (read (show (max_live_bytes stats))))
printf "Max used memory: %s\n" (convertSize (read (show (max_mem_in_use_bytes stats))))
time :: String -> IO a -> IO a
time desc io = do
start <- getCurrentTime