- Timestamp:
- Aug 16, 2024 8:55:59 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp
r105698 r105712 2944 2944 #define IEM_TIMER_POLL_MAX_ITER _512K 2945 2945 2946 2947 DECL_FORCE_INLINE(uint32_t) iemPollTimersCalcDefaultCountdown(uint64_t cNsDelta) 2946 #ifdef IEM_WITH_ADAPTIVE_TIMER_POLLING 2947 /** 2948 * Calculates the number of TBs till the next timer polling using defaults. 2949 * 2950 * This is used when the previous run wasn't long enough to provide sufficient 2951 * data and when comming back from the HALT state and we haven't actually 2952 * executed anything for a while. 2953 */ 2954 DECL_FORCE_INLINE(uint32_t) iemPollTimersCalcDefaultCountdown(uint64_t cNsDelta) RT_NOEXCEPT 2948 2955 { 2949 2956 if (cNsDelta >= IEM_TIMER_POLL_MAX_NS) … … 2960 2967 return IEM_TIMER_POLL_MIN_ITER; 2961 2968 } 2969 #endif 2962 2970 2963 2971 … … 3053 3061 STAM_COUNTER_INC(&pVCpu->iem.s.StatTimerPollTiny); 3054 3062 cItersTillNextPoll = IEM_TIMER_POLL_MIN_ITER; 3055 IEMTLBTRACE_USER0(pVCpu, TMVirtualSyncGetLag(pVM), RT_MAKE_U64(cNsSinceLast, cNsDelta), cItersTillNextPoll, 0);3056 3063 } 3057 3064 else … … 3059 3066 uint32_t const cNsDeltaAdj = cNsDelta >= IEM_TIMER_POLL_MAX_NS ? IEM_TIMER_POLL_MAX_NS : (uint32_t)cNsDelta; 3060 3067 uint32_t const cNsDeltaSlack = cNsDelta >= IEM_TIMER_POLL_MAX_NS ? IEM_TIMER_POLL_MAX_NS / 2 : cNsDeltaAdj / 4; 3061 if ( cNsSinceLast 3068 if ( cNsSinceLast < RT_MAX(IEM_TIMER_POLL_MIN_NS, 64) 3062 3069 || cItersTillNextPoll < IEM_TIMER_POLL_MIN_ITER /* paranoia */) 3063 3070 { 3064 3071 STAM_COUNTER_INC(&pVCpu->iem.s.StatTimerPollDefaultCalc); 3065 3072 cItersTillNextPoll = iemPollTimersCalcDefaultCountdown(cNsDeltaAdj); 3066 IEMTLBTRACE_USER1(pVCpu, TMVirtualSyncGetLag(pVM), RT_MAKE_U64(cNsSinceLast, cNsDelta), cItersTillNextPoll, 3);3067 3073 } 3068 3074 else if ( cNsSinceLast >= cNsDeltaAdj + cNsDeltaSlack … … 3074 3080 cItersTillNextPoll = cNsDeltaAdj / uFactor; 3075 3081 STAM_PROFILE_ADD_PERIOD(&pVCpu->iem.s.StatTimerPollFactorDivision, uFactor); 3076 IEMTLBTRACE_USER1(pVCpu, TMVirtualSyncGetLag(pVM), RT_MAKE_U64(cNsSinceLast, cNsDelta), cItersTillNextPoll, 1);3077 3082 } 3078 3083 else … … 3081 3086 cItersTillNextPoll = cNsDeltaAdj * uFactor; 3082 3087 STAM_PROFILE_ADD_PERIOD(&pVCpu->iem.s.StatTimerPollFactorMultiplication, uFactor); 3083 IEMTLBTRACE_USER1(pVCpu, TMVirtualSyncGetLag(pVM), RT_MAKE_U64(cNsSinceLast, cNsDelta), cItersTillNextPoll, 2);3084 3088 } 3085 3089 … … 3098 3102 } 3099 3103 else 3100 {3101 3104 STAM_COUNTER_INC(&pVCpu->iem.s.StatTimerPollUnchanged); 3102 IEMTLBTRACE_USER3(pVCpu, TMVirtualSyncGetLag(pVM), RT_MAKE_U64(cNsSinceLast, cNsDelta), cItersTillNextPoll, 0x00);3103 }3104 3105 } 3105 3106 pVCpu->iem.s.cTbsTillNextTimerPollPrev = cItersTillNextPoll;
Note:
See TracChangeset
for help on using the changeset viewer.