mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2026-06-20 16:45:26 +08:00
27 lines
285 B
Go
27 lines
285 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"runtime/trace"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
trace.Start(os.Stdout)
|
|
defer trace.Stop()
|
|
|
|
go b()
|
|
a()
|
|
}
|
|
|
|
func a() {
|
|
start := time.Now()
|
|
for time.Since(start) < time.Second {
|
|
}
|
|
}
|
|
|
|
func b() {
|
|
start := time.Now()
|
|
for time.Since(start) < time.Second {
|
|
}
|
|
}
|