Last active
September 23, 2020 16:39
-
-
Save dobegor/a6e7caa5c33c86af88ae66c39edbdf07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(pprof) top | |
Showing nodes accounting for 46.38s, 61.72% of 75.15s total | |
Dropped 1158 nodes (cum <= 0.38s) | |
Showing top 10 nodes out of 217 | |
flat flat% sum% cum cum% | |
14.53s 19.33% 19.33% 14.62s 19.45% runtime.adjusttimers | |
6.70s 8.92% 28.25% 6.80s 9.05% runtime.timeSleepUntil | |
5.47s 7.28% 35.53% 5.76s 7.66% runtime.findObject | |
5.44s 7.24% 42.77% 8.63s 11.48% math/big.nat.divBasic | |
5.27s 7.01% 49.78% 13.75s 18.30% runtime.scanobject | |
2.42s 3.22% 53.00% 2.42s 3.22% runtime.markBits.isMarked (inline) | |
2.27s 3.02% 56.02% 2.38s 3.17% syscall.Syscall | |
1.59s 2.12% 58.14% 1.59s 2.12% math/big.addMulVVW | |
1.47s 1.96% 60.09% 18.29s 24.34% runtime.mallocgc | |
1.22s 1.62% 61.72% 1.22s 1.62% math/big.subVV | |
(pprof) list runtime.adjusttimers | |
Total: 1.25mins | |
ROUTINE ======================== runtime.adjusttimers in runtime/time.go | |
14.53s 14.62s (flat, cum) 19.45% of Total | |
. . 647: } | |
. . 648: return | |
. . 649: } | |
. . 650: var moved []*timer | |
. . 651:loop: | |
220ms 220ms 652: for i := 0; i < len(pp.timers); i++ { | |
90ms 90ms 653: t := pp.timers[i] | |
10.22s 10.22s 654: if t.pp.ptr() != pp { | |
. . 655: throw("adjusttimers: bad p") | |
. . 656: } | |
3.78s 3.78s 657: switch s := atomic.Load(&t.status); s { | |
. . 658: case timerDeleted: | |
. . 659: if atomic.Cas(&t.status, s, timerRemoving) { | |
. 20ms 660: dodeltimer(pp, i) | |
. . 661: if !atomic.Cas(&t.status, timerRemoving, timerRemoved) { | |
. . 662: badTimer() | |
. . 663: } | |
. . 664: atomic.Xadd(&pp.deletedTimers, -1) | |
. . 665: // Look at this heap position again. | |
. . 666: i-- | |
. . 667: } | |
. . 668: case timerModifiedEarlier, timerModifiedLater: | |
. . 669: if atomic.Cas(&t.status, s, timerMoving) { | |
. . 670: // Now we can change the when field. | |
. . 671: t.when = t.nextwhen | |
. . 672: // Take t off the heap, and hold onto it. | |
. . 673: // We don't add it back yet because the | |
. . 674: // heap manipulation could cause our | |
. . 675: // loop to skip some other timer. | |
. 10ms 676: dodeltimer(pp, i) | |
150ms 190ms 677: moved = append(moved, t) | |
. . 678: if s == timerModifiedEarlier { | |
. . 679: if n := atomic.Xadd(&pp.adjustTimers, -1); int32(n) <= 0 { | |
. . 680: break loop | |
. . 681: } | |
. . 682: } | |
. . 683: // Look at this heap position again. | |
. . 684: i-- | |
. . 685: } | |
70ms 70ms 686: case timerNoStatus, timerRunning, timerRemoving, timerRemoved, timerMoving: | |
. . 687: badTimer() | |
. . 688: case timerWaiting: | |
. . 689: // OK, nothing to do. | |
. . 690: case timerModifying: | |
. . 691: // Check again after modification is complete. | |
. . 692: osyield() | |
. . 693: i-- | |
. . 694: default: | |
. . 695: badTimer() | |
. . 696: } | |
. . 697: } | |
. . 698: | |
. . 699: if len(moved) > 0 { | |
. 20ms 700: addAdjustedTimers(pp, moved) | |
. . 701: } | |
. . 702: | |
. . 703: if verifyTimers { | |
. . 704: verifyTimerHeap(pp) | |
. . 705: } | |
(pprof) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment