improve benchmark --databases

* benchmark: Changed --databases to take a parameter specifiying the size
  of the database to benchmark.
* benchmark --databases: Display size of the populated database.
* benchmark --databases: Improve the "addAssociatedFile to (new)"
  benchmark to really add new values, not overwriting old values.
This commit is contained in:
Joey Hess 2019-11-21 17:25:20 -04:00
parent 8ea5f3ff99
commit 25ba8156bc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 29 additions and 24 deletions

View file

@ -26,7 +26,7 @@ cmd generator = command "benchmark" SectionTesting
data BenchmarkOptions
= BenchmarkOptions CmdParams CriterionMode
| BenchmarkDatabases CriterionMode
| BenchmarkDatabases CriterionMode Integer
optParser :: CmdParamsDesc -> Parser BenchmarkOptions
optParser desc = benchmarkoptions <|> benchmarkdatabases
@ -36,10 +36,11 @@ optParser desc = benchmarkoptions <|> benchmarkdatabases
<*> criterionopts
benchmarkdatabases = BenchmarkDatabases
<$> criterionopts
<* flag' ()
( long "databases"
<*> option auto
( long "databases"
<> metavar paramNumber
<> help "benchmark sqlite databases"
)
)
#ifdef WITH_BENCHMARK
criterionopts = parseWith defaultConfig
#else
@ -51,7 +52,7 @@ seek :: BenchmarkGenerator -> BenchmarkOptions -> CommandSeek
seek generator (BenchmarkOptions ps mode) = do
runner <- generator ps
liftIO $ runMode mode [ bench (unwords ps) $ nfIO runner ]
seek _ (BenchmarkDatabases mode) = benchmarkDbs mode
seek _ (BenchmarkDatabases mode n) = benchmarkDbs mode n
#else
seek _ _ = giveup "git-annex is not built with benchmarking support"
#endif