simulation: Add benchmarking

This commit is contained in:
ValarDragon
2018-08-29 23:02:15 -07:00
parent fd8c1e5253
commit 46bbada4ee
8 changed files with 220 additions and 90 deletions
+21
View File
@@ -112,6 +112,27 @@ func invariants(app *GaiaApp) []simulation.Invariant {
}
}
// Profile with:
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/cmd/gaia/app -bench ^BenchmarkFullGaiaSimulation$ -cpuprofile cpu.out
func BenchmarkFullGaiaSimulation(b *testing.B) {
// Setup Gaia application
var logger log.Logger
logger = log.NewNopLogger()
db := dbm.NewMemDB()
app := NewGaiaApp(logger, db, nil)
// Run randomized simulation
// TODO parameterize numbers, save for a later PR
simulation.BenchmarkSimulationFromSeed(
b, app.BaseApp, appStateFn, seed,
testAndRunTxs(app),
[]simulation.RandSetup{},
10,
100,
false,
)
}
func TestFullGaiaSimulation(t *testing.T) {
if !enabled {
t.Skip("Skipping Gaia simulation")