Skip to content

Instantly share code, notes, and snippets.

@DanielMorsing
Created June 17, 2018 11:31
Show Gist options
  • Save DanielMorsing/c7eb1aa9a90308c9c735949a9bd8ca96 to your computer and use it in GitHub Desktop.
Save DanielMorsing/c7eb1aa9a90308c9c735949a9bd8ca96 to your computer and use it in GitHub Desktop.
causalprof
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 57e1b5dacb..31c8352ca2 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -22,6 +22,7 @@ import (
"os"
"path"
"runtime"
+ "runtime/causalprof"
"strconv"
"strings"
"sync"
@@ -1765,6 +1766,7 @@ func (c *conn) serve(ctx context.Context) {
c.bufw = newBufioWriterSize(checkConnErrorWriter{c}, 4<<10)
for {
+ prog := causalprof.StartProgress()
w, err := c.readRequest(ctx)
if c.r.remain != c.server.initialReadLimitSize() {
// If we read any bytes off the wire, we're active.
@@ -1857,6 +1859,7 @@ func (c *conn) serve(ctx context.Context) {
}
}
c.rwc.SetReadDeadline(time.Time{})
+ prog.Stop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment