Skip to content

Commit

Permalink
tests/riot.go: enable profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
suizman committed Dec 11, 2018
1 parent b252f47 commit cd0c49c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/riot.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"log"
"math"
"net/http"
_ "net/http/pprof"
"os"
"strconv"
"sync"
Expand Down Expand Up @@ -468,6 +469,7 @@ var (
wantMembership bool
offload bool
charts bool
profiling bool
incrementalDelta int
offset int
numRequests int
Expand All @@ -493,6 +495,7 @@ func init() {
usageWriteConcurrency = "Set write concurrency value"
usageOffload = "Perform reads only on %50 of the cluster size (With cluster size 2 reads will be performed only on follower1)"
usageCharts = "Create charts while executing the benchmarks. Output: graph-$testname.png"
usageProfiling = "Enable Go profiling with pprof tool. $ go tool pprof -http : http://localhost:6061 "
usageOffset = "The starting version from which we start the load"
usageWantAdd = "Execute add benchmark"
usageWantIncremental = "Execute Incremental benchmark"
Expand All @@ -507,6 +510,7 @@ func init() {
flag.BoolVar(&wantIncremental, "incremental", defaultWantIncremental, usageWantIncremental)
flag.BoolVar(&offload, "offload", false, usageOffload)
flag.BoolVar(&charts, "charts", false, usageCharts)
flag.BoolVar(&profiling, "profiling", false, usageProfiling)
flag.IntVar(&incrementalDelta, "delta", defaultIncrementalDelta, usageDelta)
flag.IntVar(&incrementalDelta, "d", defaultIncrementalDelta, usageDelta+" (shorthand)")
flag.IntVar(&numRequests, "n", defaultNumRequests, usageNumRequests)
Expand Down Expand Up @@ -559,6 +563,13 @@ func main() {

flag.Parse()

if profiling {
go func() {
fmt.Print("Go profiling enabled\n")
log.Print(http.ListenAndServe(":6061", nil))
}()
}

if offload {
n = n / 2
fmt.Printf("Offload: %v | %d\n", offload, n)
Expand Down

0 comments on commit cd0c49c

Please sign in to comment.