mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1188616 - CPOW monitoring should use JS_Now instead of PR_IntervalNow. r=jandem
This commit is contained in:
parent
d0a2a9c530
commit
744298baef
@ -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_ = JS_Now();
|
||||
}
|
||||
CPOWTimer::~CPOWTimer()
|
||||
{
|
||||
@ -33,7 +35,12 @@ CPOWTimer::~CPOWTimer()
|
||||
return;
|
||||
}
|
||||
|
||||
const int64_t endInterval = JS_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
|
||||
|
Loading…
Reference in New Issue
Block a user