Merge pull request #2214 from cosmos/dev/display_db_info
simulation: display db size at end of simulation, add makefile entries
This commit is contained in:
commit
e1ce5d42d8
11
Makefile
11
Makefile
|
@ -163,6 +163,17 @@ test_sim_gaia_slow:
|
||||||
@echo "Running full Gaia simulation. This may take awhile!"
|
@echo "Running full Gaia simulation. This may take awhile!"
|
||||||
@go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=1000 -SimulationVerbose=true -v -timeout 24h
|
@go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=1000 -SimulationVerbose=true -v -timeout 24h
|
||||||
|
|
||||||
|
SIM_NUM_BLOCKS ?= 210
|
||||||
|
SIM_BLOCK_SIZE ?= 200
|
||||||
|
SIM_COMMIT ?= true
|
||||||
|
test_sim_gaia_benchmark:
|
||||||
|
@echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!"
|
||||||
|
@go test -benchmem -run=^$$ github.com/cosmos/cosmos-sdk/cmd/gaia/app -bench ^BenchmarkFullGaiaSimulation$$ -SimulationEnabled=true -SimulationNumBlocks=$(SIM_NUM_BLOCKS) -SimulationBlockSize=$(SIM_BLOCK_SIZE) -SimulationCommit=$(SIM_COMMIT) -timeout 24h
|
||||||
|
|
||||||
|
test_sim_gaia_profile:
|
||||||
|
@echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!"
|
||||||
|
@go test -benchmem -run=^$$ github.com/cosmos/cosmos-sdk/cmd/gaia/app -bench ^BenchmarkFullGaiaSimulation$$ -SimulationEnabled=true -SimulationNumBlocks=$(SIM_NUM_BLOCKS) -SimulationBlockSize=$(SIM_BLOCK_SIZE) -SimulationCommit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out
|
||||||
|
|
||||||
test_cover:
|
test_cover:
|
||||||
@bash tests/test_cover.sh
|
@bash tests/test_cover.sh
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ FEATURES
|
||||||
* SDK
|
* SDK
|
||||||
* [querier] added custom querier functionality, so ABCI query requests can be handled by keepers
|
* [querier] added custom querier functionality, so ABCI query requests can be handled by keepers
|
||||||
* [simulation] \#1924 allow operations to specify future operations
|
* [simulation] \#1924 allow operations to specify future operations
|
||||||
* [simulation] \#1924 Add benchmarking capabilities
|
* [simulation] \#1924 Add benchmarking capabilities, with makefile commands "test_sim_gaia_benchmark, test_sim_gaia_profile"
|
||||||
|
|
||||||
* Tendermint
|
* Tendermint
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package app
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -118,7 +119,7 @@ func invariants(app *GaiaApp) []simulation.Invariant {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Profile with:
|
// Profile with:
|
||||||
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/cmd/gaia/app -bench ^BenchmarkFullGaiaSimulation$ -cpuprofile cpu.out
|
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/cmd/gaia/app -bench ^BenchmarkFullGaiaSimulation$ -SimulationCommit=true -cpuprofile cpu.out
|
||||||
func BenchmarkFullGaiaSimulation(b *testing.B) {
|
func BenchmarkFullGaiaSimulation(b *testing.B) {
|
||||||
// Setup Gaia application
|
// Setup Gaia application
|
||||||
var logger log.Logger
|
var logger log.Logger
|
||||||
|
@ -139,10 +140,15 @@ func BenchmarkFullGaiaSimulation(b *testing.B) {
|
||||||
testAndRunTxs(app),
|
testAndRunTxs(app),
|
||||||
[]simulation.RandSetup{},
|
[]simulation.RandSetup{},
|
||||||
invariants(app), // these shouldn't get ran
|
invariants(app), // these shouldn't get ran
|
||||||
210,
|
numBlocks,
|
||||||
blockSize,
|
blockSize,
|
||||||
commit,
|
commit,
|
||||||
)
|
)
|
||||||
|
if commit {
|
||||||
|
fmt.Println("GoLevelDB Stats")
|
||||||
|
fmt.Println(db.Stats()["leveldb.stats"])
|
||||||
|
fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFullGaiaSimulation(t *testing.T) {
|
func TestFullGaiaSimulation(t *testing.T) {
|
||||||
|
@ -171,7 +177,9 @@ func TestFullGaiaSimulation(t *testing.T) {
|
||||||
blockSize,
|
blockSize,
|
||||||
commit,
|
commit,
|
||||||
)
|
)
|
||||||
|
if commit {
|
||||||
|
fmt.Println("Database Size", db.Stats()["database.size"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make another test for the fuzzer itself, which just has noOp txs
|
// TODO: Make another test for the fuzzer itself, which just has noOp txs
|
||||||
|
|
Loading…
Reference in New Issue