Skip to content

Instantly share code, notes, and snippets.

View DanielMorsing's full-sized avatar

Daniel Morsing DanielMorsing

View GitHub Profile
@DanielMorsing
DanielMorsing / stacktrace.diff
Last active June 16, 2019 12:20
Patch that adds stack growth events to the trace viewer
diff --git a/src/cmd/trace/trace.go b/src/cmd/trace/trace.go
index f39a397d0d..de8348e996 100644
--- a/src/cmd/trace/trace.go
+++ b/src/cmd/trace/trace.go
@@ -739,6 +739,8 @@ func generateTrace(params *traceParams, consumer traceConsumer) error {
ctx.emitInstant(ev, "task start", "user event")
case trace.EvUserTaskEnd:
ctx.emitInstant(ev, "task end", "user event")
+ case trace.EvGoCopyStack:
+ ctx.emitInstant(ev, "copystack", "")
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"
package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
"runtime/causalprof"
"sync"
"math/rand"
)
0x4d183d /home/daniel/go/src/math/rand/rand.go:206
2542898460
5% 2324966363ns -8.57%
30% 2326460354ns -8.51%
35% 2277724044ns -10.4%
45% 2314790374ns -8.97%
50% 2243652563ns -11.8%
95% 1974680705ns -22.3%
@DanielMorsing
DanielMorsing / foo.go
Created January 31, 2016 18:07
the program
package main
import (
"runtime/causalprof"
"net/http"
"bufio"
"os"
"math/rand"
"fmt"
"sync/atomic"

Keybase proof

I hereby claim:

  • I am danielmorsing on github.
  • I am dmorsing (https://keybase.io/dmorsing) on keybase.
  • I have a public key whose fingerprint is 85A4 D9E4 546F 39F5 7891 92E4 C9C6 BA30 0461 FEBE

To claim this, I am signing this object:

[daniel@morslaptop ~]$ mkdir foo && cd foo
[daniel@morslaptop foo]$ bash -c 'cd .. && rm -rf foo'
[daniel@morslaptop foo]$ man open
man: can't change directory to '': No such file or directory
man: command exited with status 255: (cd && LESS=-ix8RmPm Manual page open(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page open(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=open(1) less -s)
diff --git a/src/net/http/transport.go b/src/net/http/transport.go
index 354b5c0..0ec5398 100644
--- a/src/net/http/transport.go
+++ b/src/net/http/transport.go
@@ -358,6 +358,7 @@ func (cm *connectMethod) proxyAuth() string {
// If pconn is no longer needed or not in a good state, putIdleConn
// returns false.
func (t *Transport) putIdleConn(pconn *persistConn) bool {
+ fmt.Println("putidle")
if t.DisableKeepAlives || t.MaxIdleConnsPerHost < 0 {
@DanielMorsing
DanielMorsing / baseutf8
Created April 19, 2015 10:37
A shitty thing I did in order to pgp sign a tweet.
package main
import (
"fmt"
"io/ioutil"
"math/big"
"os"
)
func main() {
<!--{
Navbar: "Home",
}-->
/* other stuff after this */
/* should be matched by "<!--.*-->" */