forked from GitHub/gf-core
Add memory stats to benchmark
This commit is contained in:
@@ -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"
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user