diff options
| author | Rhys Hiltner <rhys.hiltner@gmail.com> | 2024-07-26 10:14:20 -0700 |
|---|---|---|
| committer | Emmanuel Odeke <emmanuel@orijtech.com> | 2024-08-01 03:06:18 +0000 |
| commit | 6ac87aa5b36e7a9389754cf5569af94447266b47 (patch) | |
| tree | e0b975c08047cafaca8e0a651d9a4b1ec58d1cb7 /src/runtime/export_debug_test.go | |
| parent | bd85a3b1535928bcdc9bb4512f3dd9048de14617 (diff) | |
| download | go-6ac87aa5b36e7a9389754cf5569af94447266b47.tar.xz | |
runtime: measure speed of procyield and osyield
These are delay primitives for lock2. If a mutex isn't immediately
available, we can use procyield to tell the processor to wait for a
moment, or osyield to allow the OS to run a different process or thread
if one is waiting. We expect a processor-level yield to be faster than
an os-level yield, and for both of them to be fast relative to entering
a full sleep (via futexsleep or semasleep).
Each architecture has its own way of hinting to the processor that it's
in a spin-wait loop, so procyield presents an architecture-independent
interface for use in lock_futex.go and lock_sema.go.
Measure the (single-threaded) speed of these to confirm.
For #68578
Change-Id: I90cd46ea553f2990395aceb048206285558c877e
Reviewed-on: https://go-review.googlesource.com/c/go/+/601396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/export_debug_test.go')
0 files changed, 0 insertions, 0 deletions
