Add more tests, spin before inflating monitors

This adds some additional tests/benchmarks to 2029-contended-monitors.

Modify the monitor inflation logic minimally to try pure spinning
before resorting to sched_yield.

Based on my testing with 2029-contended-monitors, it would be beneficial
to more aggressively avoid lock inflation. But in the end, I couldn't
figure out how to do that effectively without taking more wall clock
time when we actually inflate a lock. That seems like a questionable
trade-off, so this is the low-risk alternative that simply avoids the
clearly dubious choice to immediately spend a microsecond or so on a
sched_yield call whenever the lock is already held.

This is somehat similar to aosp/666639, but we still try everything
we tried before to avoid inflation. (aosp/666639 with a much higher
value of max_spins would probably be similar. I expect CpuRelax()
there doesn't have much impact either way. We could add it here.)

Bug:140590186
Test: experimentation with 2029-contended-monitors.
Change-Id: I58349cc2c45dd6ea16c67c3c3bffb791274eb99e
3 files changed