1
0
mirror of https://github.com/DataDog/go-profiler-notes.git synced 2025-07-12 23:50:13 +02:00

Add CPU profiler section

This commit is contained in:
Felix Geisendörfer
2021-09-09 23:46:41 +02:00
parent fd511c528d
commit 6b9adbfc74
12 changed files with 218 additions and 37 deletions

View File

@ -4,25 +4,13 @@ package main
import (
"fmt"
"sync"
"sync/atomic"
)
func main() {
var (
sum int32
wg = &sync.WaitGroup{}
)
wg.Add(2)
go add(&sum, 23, wg)
go add(&sum, 42, wg)
wg.Wait()
fmt.Println(sum)
fmt.Println(*add(23, 42))
}
func add(dst *int32, delta int32, wg *sync.WaitGroup) {
atomic.AddInt32(dst, delta)
wg.Done()
func add(a, b int) *int {
sum := a + b
return &sum
}