mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2026-06-21 00:46:51 +08:00
add time graphics (not used yet)
This commit is contained in:
parent
1760fb4061
commit
7cb65b749c
5 changed files with 26 additions and 0 deletions
26
guide/http-get.go
Normal file
26
guide/http-get.go
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
//go:build ignore
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"runtime/trace"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
traceF, _ := os.Create("trace.out")
|
||||||
|
trace.Start(traceF)
|
||||||
|
defer trace.Stop()
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
res, err := http.Get("https://example.org/")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Printf("%d\n", res.StatusCode)
|
||||||
|
log.Printf("main() took: %s\n", time.Since(start))
|
||||||
|
}
|
||||||
BIN
guide/time.1.png
Normal file
BIN
guide/time.1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 219 KiB |
BIN
guide/time.2.png
Normal file
BIN
guide/time.2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 319 KiB |
BIN
guide/time.3.png
Normal file
BIN
guide/time.3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
guide/trace.out
Normal file
BIN
guide/trace.out
Normal file
Binary file not shown.
Loading…
Reference in a new issue