From 2b4927e6ce74a5a6f71c647af9ef765f81ba2bff Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 13 Dec 2017 11:25:10 +0100 Subject: prog: add benchmark for Mutate --- prog/mutation_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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) + } + }) +} -- cgit mrf-deployment