scheudler: Cache ThreadData::IsCPUBound() result
This commit is contained in:
parent
b7d404c2df
commit
f978518a52
@ -18,6 +18,7 @@ ThreadData::_InitBase()
|
||||
fPriorityPenalty = 0;
|
||||
fAdditionalPenalty = 0;
|
||||
fEffectivePriority = GetPriority();
|
||||
fCPUBound = false;
|
||||
|
||||
fTimeUsed = 0;
|
||||
fStolenTime = 0;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
|
||||
inline int32 GetEffectivePriority() const;
|
||||
|
||||
inline bool IsCPUBound() const;
|
||||
inline bool IsCPUBound() const { return fCPUBound; }
|
||||
|
||||
inline void CancelPenalty();
|
||||
inline bool ShouldCancelPenalty() const;
|
||||
@ -116,6 +116,7 @@ private:
|
||||
|
||||
Thread* fThread;
|
||||
|
||||
bool fCPUBound;
|
||||
int32 fPriorityPenalty;
|
||||
int32 fAdditionalPenalty;
|
||||
|
||||
@ -207,21 +208,15 @@ ThreadData::_IncreasePenalty()
|
||||
|
||||
int32 oldPenalty = fPriorityPenalty++;
|
||||
const int kMinimalPriority = _GetMinimalPriority();
|
||||
if (GetPriority() - oldPenalty <= kMinimalPriority)
|
||||
if (GetPriority() - oldPenalty <= kMinimalPriority) {
|
||||
fPriorityPenalty = oldPenalty;
|
||||
fCPUBound = true;
|
||||
}
|
||||
|
||||
_ComputeEffectivePriority();
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
ThreadData::IsCPUBound() const
|
||||
{
|
||||
SCHEDULER_ENTER_FUNCTION();
|
||||
return GetPriority() - fPriorityPenalty == _GetMinimalPriority();
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
ThreadData::CancelPenalty()
|
||||
{
|
||||
@ -229,6 +224,7 @@ ThreadData::CancelPenalty()
|
||||
|
||||
int32 oldPenalty = fPriorityPenalty;
|
||||
fPriorityPenalty = 0;
|
||||
fCPUBound = false;
|
||||
|
||||
if (oldPenalty != 0) {
|
||||
TRACE("cancelling thread %ld penalty\n", fThread->id);
|
||||
|
Loading…
Reference in New Issue
Block a user