]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: increase windows prof thread priority sooner
authorAlex Brainman <alex.brainman@gmail.com>
Wed, 3 Sep 2014 04:17:04 +0000 (14:17 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 3 Sep 2014 04:17:04 +0000 (14:17 +1000)
If system is busy burning cpu, it takes long time (about 300ms on
windows builders) to adjust prof thread priority. Once adjusted, prof
thread runs ahead of everyone else, but due to initial slowness, it
does not capture prof snapshots until start-up period is completed.

Change prof thread priority sooner, so it can start captures straight
away.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/134360043

src/pkg/runtime/os_windows.c

index 43026d64577c23ac0435bc052e953be00677b3bc..172fd92285c2cd1210c63e12f255a1f2e3e1c787 100644 (file)
@@ -570,6 +570,7 @@ runtime·resetcpuprofiler(int32 hz)
                runtime·atomicstorep(&profiletimer, timer);
                thread = runtime·stdcall6(runtime·CreateThread,
                        (uintptr)nil, (uintptr)nil, (uintptr)runtime·profileloop, (uintptr)nil, (uintptr)nil, (uintptr)nil);
+               runtime·stdcall2(runtime·SetThreadPriority, (uintptr)thread, THREAD_PRIORITY_HIGHEST);
                runtime·stdcall1(runtime·CloseHandle, (uintptr)thread);
        }
        runtime·unlock(&lock);