You've already forked go-profiler-notes
mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2025-07-12 23:50:13 +02:00
add example
This commit is contained in:
22
examples/stackannotate/main.go
Normal file
22
examples/stackannotate/main.go
Normal file
@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
var n int
|
||||
for i := 0; i < 10; i++ {
|
||||
n += foo(1)
|
||||
}
|
||||
println(n)
|
||||
<-chan struct{}(nil)
|
||||
}
|
||||
|
||||
func foo(a int) int {
|
||||
return bar(a, 2)
|
||||
}
|
||||
|
||||
func bar(a int, b int) int {
|
||||
s := 3
|
||||
for i := 0; i < 100; i++ {
|
||||
s += a * b
|
||||
}
|
||||
return s
|
||||
}
|
Reference in New Issue
Block a user