]> Cypherpunks repositories - gostls13.git/commit
runtime/pprof: speed up CPU profiling shutdown
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 1 Jan 2020 05:24:20 +0000 (21:24 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 20 Apr 2020 15:52:05 +0000 (15:52 +0000)
commit1f0738c1577a55a6b7229b821ddfe762b84771d0
treef5d385cd8aa706b20c66c93b7da49fe1b2bc43a2
parent12d1c9b863ab5135d498a031616ff8a172e471a4
runtime/pprof: speed up CPU profiling shutdown

The core CPU profiling loop contains a 100ms sleep.
This is important to reduce overhead.

However, it means that it takes 200ms to shutting down a program
with CPU profiling enabled. When trying to collect many samples
by running a short-lived program many times, this adds up.

This change cuts the shutdown penalty in half by skipping
the sleep whenever possible.

Change-Id: Ic3177f8e1a2d331fe1a1ecd7c8c06f50beb42535
Reviewed-on: https://go-review.googlesource.com/c/go/+/228886
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
src/runtime/pprof/pprof.go