And it looks like the `semacquire1` executed too many `gopark`, which means indicating that `cansemacquire` failed a lot when too much contention happens.
On Monday, August 26, 2019 at 6:27:14 PM UTC+2, changkun wrote: > > Sorry for late response. Do you mean the total execution was not the same? > If so then it is not true, you see below two bench are executed both 50000000 > times: > > goos: linux > goarch: amd64 > BenchmarkMutexWrite/goroutines-2400-8 50000000 > 46.5 ns/op > > Type: cpu > Time: Aug 26, 2019 at 6:19pm (CEST) > Duration: 2.50s, Total samples = 5.47s (218.62%) > Entering interactive mode (type "help" for commands, "o" for options) > (pprof) top20 > Showing nodes accounting for 5.14s, 93.97% of 5.47s total > Dropped 15 nodes (cum <= 0.03s) > Showing top 20 nodes out of 48 > flat flat% sum% cum cum% > 1.77s 32.36% 32.36% 1.77s 32.36% runtime.procyield > 1.08s 19.74% 52.10% 2.20s 40.22% sync.(*Mutex).Lock > 0.40s 7.31% 59.41% 1.34s 24.50% sync.(*Mutex).Unlock > 0.32s 5.85% 65.27% 2.06s 37.66% runtime.lock > 0.23s 4.20% 69.47% 1.53s 27.97% runtime.findrunnable > 0.20s 3.66% 73.13% 0.25s 4.57% runtime.unlock > 0.18s 3.29% 76.42% 0.19s 3.47% runtime.pidleput > 0.13s 2.38% 78.79% 0.13s 2.38% runtime.cansemacquire > 0.12s 2.19% 80.99% 0.12s 2.19% runtime.futex > 0.10s 1.83% 82.82% 0.11s 2.01% sync.runtime_nanotime > 0.09s 1.65% 84.46% 3.64s 66.54% > _/home/changkun/dev/tests_test.BenchmarkMutexWrite.func1.1 > 0.09s 1.65% 86.11% 0.09s 1.65% runtime.casgstatus > 0.08s 1.46% 87.57% 0.08s 1.46% runtime.(*semaRoot).dequeue > 0.08s 1.46% 89.03% 0.94s 17.18% runtime.semrelease1 > 0.07s 1.28% 90.31% 0.07s 1.28% runtime.gopark > 0.06s 1.10% 91.41% 0.97s 17.73% runtime.semacquire1 > 0.04s 0.73% 92.14% 0.04s 0.73% runtime.runqempty > 0.04s 0.73% 92.87% 0.04s 0.73% sync.runtime_canSpin > 0.03s 0.55% 93.42% 0.03s 0.55% runtime.(*guintptr).cas > 0.03s 0.55% 93.97% 0.03s 0.55% runtime.gogo > > > -------------------- > > goos: linux > goarch: amd64 > BenchmarkMutexWrite/goroutines-4800-8 50000000 317 > ns/op > PASS > ok _/home/changkun/dev/tests 16.020s > > Type: cpu > Time: Aug 26, 2019 at 6:18pm (CEST) > Duration: 16.01s, Total samples = 17.03s (106.35%) > Entering interactive mode (type "help" for commands, "o" for options) > (pprof) top20 > Showing nodes accounting for 14640ms, 85.97% of 17030ms total > Dropped 19 nodes (cum <= 85.15ms) > Showing top 20 nodes out of 51 > flat flat% sum% cum cum% > 2130ms 12.51% 12.51% 2160ms 12.68% runtime.gopark > 1940ms 11.39% 23.90% 7210ms 42.34% sync.(*Mutex).Lock > 1640ms 9.63% 33.53% 1810ms 10.63% sync.runtime_nanotime > 1490ms 8.75% 42.28% 4560ms 26.78% runtime.semacquire1 > 1130ms 6.64% 48.91% 1130ms 6.64% runtime.casgstatus > 800ms 4.70% 53.61% 3740ms 21.96% runtime.semrelease1 > 590ms 3.46% 57.08% 590ms 3.46% runtime.(*guintptr).cas > 560ms 3.29% 60.36% 560ms 3.29% runtime.futex > 530ms 3.11% 63.48% 610ms 3.58% runtime.lock > 520ms 3.05% 66.53% 520ms 3.05% runtime.unlock > 440ms 2.58% 69.11% 440ms 2.58% runtime.semroot > 430ms 2.52% 71.64% 430ms 2.52% runtime.usleep > 430ms 2.52% 74.16% 4210ms 24.72% sync.(*Mutex).Unlock > 370ms 2.17% 76.34% 1320ms 7.75% runtime.ready > 370ms 2.17% 78.51% 4930ms 28.95% sync.runtime_SemacquireMutex > 340ms 2.00% 80.50% 340ms 2.00% runtime.(*semaRoot).dequeue > 270ms 1.59% 82.09% 11820ms 69.41% > _/home/changkun/dev/tests_test.BenchmarkMutexWrite.func1.1 > 220ms 1.29% 83.38% 220ms 1.29% runtime.cansemacquire > 220ms 1.29% 84.67% 290ms 1.70% runtime.releaseSudog > 220ms 1.29% 85.97% 2490ms 14.62% runtime.schedule > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f75c01a0-d953-483d-87a7-b3b878871d8b%40googlegroups.com.