зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1162242 - Part 2: Remove DEBUG_TIMERS. r=froydnj
Now that PR_LOGGING is always defined DEBUG_TIMERS will always be set. It can now be removed.
This commit is contained in:
Родитель
645b42df1f
Коммит
6417f13e09
|
@ -260,13 +260,11 @@ TimerThread::Run()
|
|||
RemoveTimerInternal(timer);
|
||||
timer = nullptr;
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
PR_LOG(GetTimerLog(), PR_LOG_DEBUG,
|
||||
("Timer thread woke up %fms from when it was supposed to\n",
|
||||
fabs((now - timerRef->mTimeout).ToMilliseconds())));
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
// We release mMonitor around the Fire call to avoid deadlock.
|
||||
|
@ -346,7 +344,6 @@ TimerThread::Run()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
if (waitFor == PR_INTERVAL_NO_TIMEOUT)
|
||||
PR_LOG(GetTimerLog(), PR_LOG_DEBUG,
|
||||
|
@ -355,7 +352,6 @@ TimerThread::Run()
|
|||
PR_LOG(GetTimerLog(), PR_LOG_DEBUG,
|
||||
("waiting for %u\n", PR_IntervalToMilliseconds(waitFor)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
mWaiting = true;
|
||||
|
|
|
@ -24,8 +24,6 @@ using mozilla::TimeStamp;
|
|||
static Atomic<int32_t> gGenerator;
|
||||
static TimerThread* gThread = nullptr;
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
|
||||
PRLogModuleInfo*
|
||||
GetTimerLog()
|
||||
{
|
||||
|
@ -61,7 +59,6 @@ myNS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues,
|
|||
*meanResult = mean;
|
||||
*stdDevResult = stdDev;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -127,9 +124,7 @@ public:
|
|||
sAllocatorUsers++;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
TimeStamp mInitTime;
|
||||
#endif
|
||||
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
@ -318,7 +313,6 @@ nsTimerImpl::Startup()
|
|||
void
|
||||
nsTimerImpl::Shutdown()
|
||||
{
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
double mean = 0, stddev = 0;
|
||||
myNS_MeanAndStdDev(sDeltaNum, sDeltaSum, sDeltaSumSquared, &mean, &stddev);
|
||||
|
@ -329,7 +323,6 @@ nsTimerImpl::Shutdown()
|
|||
PR_LOG(GetTimerLog(), PR_LOG_DEBUG,
|
||||
("mean: %fms, stddev: %fms\n", mean, stddev));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gThread) {
|
||||
return;
|
||||
|
@ -575,7 +568,6 @@ nsTimerImpl::Fire()
|
|||
mozilla::tasktracer::AutoRunFakeTracedTask runTracedTask(mTracedTask);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
TimeDuration a = now - mStart; // actual delay in intervals
|
||||
|
@ -600,7 +592,6 @@ nsTimerImpl::Fire()
|
|||
mStart = mStart2;
|
||||
mStart2 = TimeStamp();
|
||||
}
|
||||
#endif
|
||||
|
||||
TimeStamp timeout = mTimeout;
|
||||
if (IsRepeatingPrecisely()) {
|
||||
|
@ -659,13 +650,11 @@ nsTimerImpl::Fire()
|
|||
mFiring = false;
|
||||
mTimerCallbackWhileFiring = nullptr;
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
PR_LOG(GetTimerLog(), PR_LOG_DEBUG,
|
||||
("[this=%p] Took %fms to fire timer callback\n",
|
||||
this, (TimeStamp::Now() - now).ToMilliseconds()));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reschedule repeating timers, except REPEATING_PRECISE which already did
|
||||
// that in PostTimerEvent, but make sure that we aren't armed already (which
|
||||
|
@ -711,14 +700,12 @@ nsTimerEvent::Run()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
PR_LOG(GetTimerLog(), PR_LOG_DEBUG,
|
||||
("[this=%p] time between PostTimerEvent() and Fire(): %fms\n",
|
||||
this, (now - mInitTime).ToMilliseconds()));
|
||||
}
|
||||
#endif
|
||||
|
||||
mTimer->Fire();
|
||||
// Since nsTimerImpl is not thread-safe, we should release |mTimer|
|
||||
|
@ -754,11 +741,9 @@ nsTimerImpl::PostTimerEvent(already_AddRefed<nsTimerImpl> aTimerRef)
|
|||
return timer.forget();
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
event->mInitTime = TimeStamp::Now();
|
||||
}
|
||||
#endif
|
||||
|
||||
// If this is a repeating precise timer, we need to calculate the time for
|
||||
// the next timer to fire before we make the callback.
|
||||
|
@ -803,7 +788,6 @@ nsTimerImpl::SetDelayInternal(uint32_t aDelay)
|
|||
|
||||
mTimeout += delayInterval;
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {
|
||||
if (mStart.IsNull()) {
|
||||
mStart = now;
|
||||
|
@ -811,7 +795,6 @@ nsTimerImpl::SetDelayInternal(uint32_t aDelay)
|
|||
mStart2 = now;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#endif
|
||||
|
||||
extern PRLogModuleInfo* GetTimerLog();
|
||||
#define DEBUG_TIMERS 1
|
||||
|
||||
#define NS_TIMER_CID \
|
||||
{ /* 5ff24248-1dd2-11b2-8427-fbab44f29bc8 */ \
|
||||
|
@ -153,13 +152,10 @@ private:
|
|||
nsRefPtr<mozilla::tasktracer::FakeTracedTask> mTracedTask;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TIMERS
|
||||
TimeStamp mStart, mStart2;
|
||||
static double sDeltaSum;
|
||||
static double sDeltaSumSquared;
|
||||
static double sDeltaNum;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsTimerImpl_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче