blob: e850d8f200119a4110a66e0bba3af6ef62a5615d [file] [log] [blame]
Keith Randall50bc3d52014-12-15 14:39:28 -08001// run
2
3// Copyright 2014 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
9import (
10 "bytes"
11 "runtime"
12 "runtime/pprof"
13 "sync"
14)
15
16func test() {
17 var wg sync.WaitGroup
18 wg.Add(2)
19 test := func() {
Keith Randallfcfbeb32015-01-07 16:46:29 -080020 for i := 0; i < 10; i++ {
Keith Randall50bc3d52014-12-15 14:39:28 -080021 buf := &bytes.Buffer{}
22 pprof.Lookup("goroutine").WriteTo(buf, 2)
23 }
24 wg.Done()
25 }
26
27 go test()
28 go test()
29 wg.Wait()
30}
31
32func main() {
Keith Randallfcfbeb32015-01-07 16:46:29 -080033 runtime.GOMAXPROCS(4)
34 for i := 0; i < 10; i++ {
Keith Randall50bc3d52014-12-15 14:39:28 -080035 test()
36 }
37}