Created
August 9, 2017 15:12
-
-
Save DanielMorsing/c73c14b5899fcd8a9d9e3be6838282c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| _ "net/http/pprof" | |
| "runtime/causalprof" | |
| "sync" | |
| "math/rand" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", foo) | |
| http.ListenAndServe("localhost:8080", nil) | |
| } | |
| var m sync.RWMutex | |
| func foo(rw http.ResponseWriter, req *http.Request) { | |
| p := causalprof.StartProgress() | |
| m.RLock() | |
| fmt.Fprintln(rw, "whatup") | |
| m.RUnlock() | |
| p.Stop() | |
| if rand.Intn(100) == 0 { | |
| m.Lock() | |
| ch := make(chan int, 1) | |
| go func() { | |
| bar() | |
| ch <- 1 | |
| }() | |
| <-ch | |
| m.Unlock() | |
| } | |
| } | |
| func bar() { | |
| for i := 0; i < 100000000; i++ {} | |
| } | |
| // gotip run $% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0x47b245 /home/daniel/go/src/syscall/zsyscall_linux_amd64.go:1029 | |
| 0% 30577668ns | |
| 30% 31514493ns +3.06% | |
| 0x653334 /home/daniel/go/src/net/http/header.go:46 | |
| no null experiment, skip | |
| 0x434ab7 /home/daniel/go/src/runtime/proc.go:2329 | |
| 0% 30999084ns | |
| 0x44b722 /home/daniel/go/src/runtime/symtab.go:726 | |
| 0% 31455962ns | |
| 0x41e494 /home/daniel/go/src/runtime/mgcmark.go:779 | |
| no null experiment, skip | |
| 0x440384 /home/daniel/go/src/runtime/sema.go:66 | |
| 0% 31383410ns | |
| 0x65500b /home/daniel/go/src/net/http/server.go:364 | |
| no null experiment, skip | |
| 0x65db09 /home/daniel/go/src/net/http/server.go:2172 | |
| 0% 24921347ns | |
| 0x6e3162 /home/daniel/src/github.com/DanielMorsing/test/foobar.go:29 | |
| 0% 24486960ns | |
| 5% 26024808ns +6.28% | |
| 10% 28369246ns +15.9% | |
| 15% 26537050ns +8.37% | |
| 20% 21538955ns -12% | |
| 25% 21108880ns -13.8% | |
| 30% 19283509ns -21.2% | |
| 35% 17088468ns -30.2% | |
| 40% 17652392ns -27.9% | |
| 45% 12271748ns -49.9% | |
| 50% 14961467ns -38.9% | |
| 55% 11343666ns -53.7% | |
| 60% 11790047ns -51.9% | |
| 65% 13001082ns -46.9% | |
| 70% 9152066ns -62.6% | |
| 75% 7430681ns -69.7% | |
| 80% 7925614ns -67.6% | |
| 85% 7325838ns -70.1% | |
| 90% 4147780ns -83.1% | |
| 95% 3696183ns -84.9% | |
| 100% 54509441ns +123% | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment