aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-13 11:25:10 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-17 11:39:14 +0100
commit2b4927e6ce74a5a6f71c647af9ef765f81ba2bff (patch)
tree157ad77fb8b7035de79d0c64372a0953b5e7c2aa /prog/mutation_test.go
parentf2d5384a68f4d7b18bf2917e593f24a5fd5e383f (diff)
prog: add benchmark for Mutate
Diffstat (limited to 'prog/mutation_test.go')
-rw-r--r--prog/mutation_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/prog/mutation_test.go b/prog/mutation_test.go
index 418ca3659..771c6c143 100644
--- a/prog/mutation_test.go
+++ b/prog/mutation_test.go
@@ -331,3 +331,23 @@ func TestMinimizeCallIndex(t *testing.T) {
}
}
}
+
+func BenchmarkMutate(b *testing.B) {
+ olddebug := debug
+ debug = false
+ defer func() { debug = olddebug }()
+ target, err := GetTarget("linux", "amd64")
+ if err != nil {
+ b.Fatal(err)
+ }
+ prios := target.CalculatePriorities(nil)
+ ct := target.BuildChoiceTable(prios, nil)
+ const progLen = 30
+ p := target.Generate(rand.NewSource(0), progLen, nil)
+ b.RunParallel(func(pb *testing.PB) {
+ rs := rand.NewSource(0)
+ for pb.Next() {
+ p.Clone().Mutate(rs, progLen, ct, nil)
+ }
+ })
+}