Skip to content

Commit b9b904c

Browse files
Merge pull request #12 from redis-performance/pprof.producer
Enabling pprof on producer flow
2 parents 223c294 + 32140a7 commit b9b904c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/producer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"log"
1515
"math"
1616
"math/rand"
17+
"net/http"
1718
"os"
1819
"os/signal"
1920
"sync"
@@ -72,6 +73,7 @@ var producerCmd = &cobra.Command{
7273
loop, _ := cmd.Flags().GetBool("loop")
7374
readBufferEachConn, _ := cmd.Flags().GetInt("read-buffer-each-conn")
7475
writeBufferEachConn, _ := cmd.Flags().GetInt("write-buffer-each-conn")
76+
pprofPort, _ := cmd.Flags().GetInt64("pprof-port")
7577

7678
if nClients > uint64(keyspaceLen) {
7779
log.Fatalf("The number of clients needs to be smaller or equal to the number of streams")
@@ -83,6 +85,10 @@ var producerCmd = &cobra.Command{
8385
// a WaitGroup for the goroutines to tell us they've stopped
8486
wg := sync.WaitGroup{}
8587

88+
go func() {
89+
http.ListenAndServe(fmt.Sprintf(":%d", pprofPort), nil)
90+
}()
91+
8692
fmt.Printf("Using random seed: %d. Each client will have seed of %d+<client id>\n", seed, seed)
8793

8894
var requestRate = Inf

0 commit comments

Comments
 (0)