diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-01-20 18:04:20 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-01-20 18:04:20 +0100 |
| commit | cde826031afb32fc7bc854a2a0da4355f984962e (patch) | |
| tree | 8e01c1492b8042df525fa5909fde50c3a8381f79 | |
| parent | 0298b1afb6d50f9c05538010971279c1f0cff9a2 (diff) | |
syz-fuzzer: expose pprof profiling
| -rw-r--r-- | syz-fuzzer/fuzzer.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go index efd7cf645..6f5559736 100644 --- a/syz-fuzzer/fuzzer.go +++ b/syz-fuzzer/fuzzer.go @@ -13,10 +13,13 @@ import ( "flag" "fmt" "math/rand" + "net/http" + _ "net/http/pprof" "net/rpc" "net/rpc/jsonrpc" "os" "os/signal" + "runtime" "runtime/debug" "strconv" "strings" @@ -41,6 +44,7 @@ var ( flagProcs = flag.Int("procs", 1, "number of parallel test processes") flagLeak = flag.Bool("leak", false, "detect memory leaks") flagOutput = flag.String("output", "stdout", "write programs to none/stdout/dmesg/file") + flagPprof = flag.String("pprof", "", "address to serve pprof profiles") ) const ( @@ -114,6 +118,15 @@ func main() { os.Exit(1) }() + if *flagPprof != "" { + go func() { + err := http.ListenAndServe(*flagPprof, nil) + Fatalf("failed to serve pprof profiles: %v", err) + }() + } else { + runtime.MemProfileRate = 0 + } + corpusCover = make([]cover.Cover, sys.CallCount) maxCover = make([]cover.Cover, sys.CallCount) corpusHashes = make(map[Sig]struct{}) |
