Bug 1188616 - CPOW monitoring should use JS_Now instead of PR_IntervalNow. r=jandem

--HG--
extra : transplant_source : %B9h%9D%1B%CF%19%D5%D9%D2%BDo.%3D%D9%EB%0E%03%EF%95%B7
This commit is contained in:
David Rajchenbach-Teller 2015-07-30 14:29:52 +02:00
Родитель 49d83b3b7d
Коммит 0ee3baf799
2 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -9,6 +9,8 @@
#include "nsContentUtils.h"
#include "CPOWTimer.h"
#include "jsapi.h"
CPOWTimer::CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(nullptr)
, startInterval_(0)
@ -18,7 +20,7 @@ CPOWTimer::CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
if (!js::GetStopwatchIsMonitoringCPOW(runtime))
return;
cx_ = cx;
startInterval_ = PR_IntervalNow();
startInterval_ = PR_Now();
}
CPOWTimer::~CPOWTimer()
{
@ -33,7 +35,12 @@ CPOWTimer::~CPOWTimer()
return;
}
const int64_t endInterval = PR_Now();
if (endInterval <= startInterval_) {
// Do not assume monotonicity.
return;
}
js::PerformanceData* performance = js::GetPerformanceData(runtime);
uint64_t duration = PR_IntervalToMicroseconds(PR_IntervalNow() - startInterval_);
performance->totalCPOWTime += duration;
performance->totalCPOWTime += endInterval - startInterval_;
}

Просмотреть файл

@ -38,7 +38,7 @@ class MOZ_STACK_CLASS CPOWTimer final {
* The instant at which the stopwatch was started. Undefined
* if CPOW monitoring was off when the timer was created.
*/
PRIntervalTime startInterval_;
int64_t startInterval_;
};
#endif