1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // This program failed when run under the C/C++ ThreadSanitizer. The
8 // TSAN library was not keeping track of whether signals should be
9 // delivered on the alternate signal stack, and the Go signal handler
10 // was not preserving callee-saved registers from C callers.
13 #cgo CFLAGS: -g -fsanitize=thread
14 #cgo LDFLAGS: -g -fsanitize=thread
21 struct timeval tvstart, tvnow;
23 void *prev = NULL, *cur;
25 gettimeofday(&tvstart, NULL);
26 for (n = 0; n < 1<<20; n++) {
31 gettimeofday(&tvnow, NULL);
32 diff = (tvnow.tv_sec - tvstart.tv_sec) * 1000 * 1000 + (tvnow.tv_usec - tvstart.tv_usec);
34 // Profile frequency is 100Hz so we should definitely
35 // get a signal in 50 milliseconds.
36 if (diff > 50 * 1000) {
54 for n := 0; n < 1<<20; n++ {
56 if time.Since(start) > 50*time.Millisecond {
63 pprof.StartCPUProfile(io.Discard)
66 pprof.StopCPUProfile()