diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2014-02-10 15:40:55 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-02-10 15:40:55 +0400 |
| commit | 0229dc6dbe969ee06f0e1f13df70b9c7fead68dd (patch) | |
| tree | 355dc3a38ba35962d28f891109e0d9350c6c165f /src/pkg/runtime/lock_futex.c | |
| parent | fa3a2a84cc2f4aa10ddb2a205e9fb0656d46ff83 (diff) | |
| download | go-0229dc6dbe969ee06f0e1f13df70b9c7fead68dd.tar.xz | |
runtime: do not cpu profile idle threads on windows
Currently this leads to a significant skew towards 'etext' entry,
since all idle threads are profiled every tick.
Before:
Total: 66608 samples
63188 94.9% 94.9% 63188 94.9% etext
278 0.4% 95.3% 278 0.4% sweepspan
216 0.3% 95.6% 448 0.7% runtime.mallocgc
122 0.2% 95.8% 122 0.2% scanblock
113 0.2% 96.0% 113 0.2% net/textproto.canonicalMIMEHeaderKey
After:
Total: 8008 samples
3949 49.3% 49.3% 3949 49.3% etext
231 2.9% 52.2% 231 2.9% scanblock
211 2.6% 54.8% 211 2.6% runtime.cas64
182 2.3% 57.1% 408 5.1% runtime.mallocgc
178 2.2% 59.3% 178 2.2% runtime.atomicload64
LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=golang-codereviews
https://golang.org/cl/61250043
Diffstat (limited to 'src/pkg/runtime/lock_futex.c')
| -rw-r--r-- | src/pkg/runtime/lock_futex.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pkg/runtime/lock_futex.c b/src/pkg/runtime/lock_futex.c index e6e9be9239..c16ac905dd 100644 --- a/src/pkg/runtime/lock_futex.c +++ b/src/pkg/runtime/lock_futex.c @@ -130,8 +130,11 @@ runtime·notesleep(Note *n) { if(g != m->g0) runtime·throw("notesleep not on g0"); - while(runtime·atomicload((uint32*)&n->key) == 0) + while(runtime·atomicload((uint32*)&n->key) == 0) { + m->blocked = true; runtime·futexsleep((uint32*)&n->key, 0, -1); + m->blocked = false; + } } #pragma textflag NOSPLIT @@ -143,8 +146,11 @@ notetsleep(Note *n, int64 ns, int64 deadline, int64 now) // does not count against our nosplit stack sequence. if(ns < 0) { - while(runtime·atomicload((uint32*)&n->key) == 0) + while(runtime·atomicload((uint32*)&n->key) == 0) { + m->blocked = true; runtime·futexsleep((uint32*)&n->key, 0, -1); + m->blocked = false; + } return true; } @@ -153,7 +159,9 @@ notetsleep(Note *n, int64 ns, int64 deadline, int64 now) deadline = runtime·nanotime() + ns; for(;;) { + m->blocked = true; runtime·futexsleep((uint32*)&n->key, 0, ns); + m->blocked = false; if(runtime·atomicload((uint32*)&n->key) != 0) break; now = runtime·nanotime(); |
