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
|
### Running
|
||||||
|
|
||||||
```
|
```
|
||||||
stack build --test --bench --no-run-tests --no-run-benchmarks && time stack bench
|
stack build --test --bench --no-run-tests --no-run-benchmarks
|
||||||
stack build --test --bench --no-run-tests --no-run-benchmarks && time PGF_ONLY=1 stack bench
|
stack bench --benchmark-arguments "+RTS -T -RTS"
|
||||||
stack build --test --bench --no-run-tests --no-run-benchmarks && time LPGF_ONLY=1 stack bench
|
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 System.FilePath ((</>), takeBaseName, takeExtension)
|
||||||
import Text.Printf (printf)
|
import Text.Printf (printf)
|
||||||
|
|
||||||
|
import GHC.Stats
|
||||||
|
|
||||||
dir :: FilePath
|
dir :: FilePath
|
||||||
dir = "testsuite" </> "lpgf"
|
dir = "testsuite" </> "lpgf"
|
||||||
|
|
||||||
@@ -61,6 +63,10 @@ main = do
|
|||||||
time "linearise LPGF" (return $ length $ linLPGF lpgf trees)
|
time "linearise LPGF" (return $ length $ linLPGF lpgf trees)
|
||||||
return ()
|
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 :: String -> IO a -> IO a
|
||||||
time desc io = do
|
time desc io = do
|
||||||
start <- getCurrentTime
|
start <- getCurrentTime
|
||||||
|
|||||||
Reference in New Issue
Block a user