From af1c7c6c2688c41564a82f34f355f365fbd32b57 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 20 Jun 2014 18:41:54 -0700 Subject: [PATCH] Add -path option To use something other than /tmp for the data files --- src/tools/benchmark-storage/config.go | 1 + src/tools/benchmark-storage/main.go | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tools/benchmark-storage/config.go b/src/tools/benchmark-storage/config.go index bcedf06e7e..f23acd88d7 100644 --- a/src/tools/benchmark-storage/config.go +++ b/src/tools/benchmark-storage/config.go @@ -18,6 +18,7 @@ type Config struct { nextSeriesId int nextSequence int64 now time.Time + path string } func (c *Config) MakeBatch() []storage.Write { diff --git a/src/tools/benchmark-storage/main.go b/src/tools/benchmark-storage/main.go index 962c081995..7db756dbd4 100644 --- a/src/tools/benchmark-storage/main.go +++ b/src/tools/benchmark-storage/main.go @@ -19,6 +19,7 @@ func main() { points := flag.Int("points", 200000000, "Number of points") batchSize := flag.Int("batch", 1000, "Batch size") series := flag.Int("series", 1, "Number of series") + path := flag.String("path", "/tmp", "Path to DB files") flag.Parse() os.RemoveAll("/tmp/test-leveldb") @@ -26,10 +27,10 @@ func main() { os.RemoveAll("/tmp/test-rocksdb") os.RemoveAll("/tmp/test-hyperleveldb") - benchmark("lmdb", Config{*points, *batchSize, *series, 0, 0, time.Now()}) - benchmark("leveldb", Config{*points, *batchSize, *series, 0, 0, time.Now()}) - benchmark("rocksdb", Config{*points, *batchSize, *series, 0, 0, time.Now()}) - benchmark("hyperleveldb", Config{*points, *batchSize, *series, 0, 0, time.Now()}) + benchmark("lmdb", Config{*points, *batchSize, *series, 0, 0, time.Now(), *path}) + benchmark("leveldb", Config{*points, *batchSize, *series, 0, 0, time.Now(), *path}) + benchmark("rocksdb", Config{*points, *batchSize, *series, 0, 0, time.Now(), *path}) + benchmark("hyperleveldb", Config{*points, *batchSize, *series, 0, 0, time.Now(), *path}) } func benchmark(name string, c Config) { @@ -39,7 +40,7 @@ func benchmark(name string, c Config) { } conf := init.NewConfig() - db, err := init.Initialize(fmt.Sprintf("/tmp/test-%s", name), conf) + db, err := init.Initialize(fmt.Sprintf("%s/test-%s", c.path, name), conf) defer db.Close()