Files
palemoon27/js/ipc/CPOWTimer.cpp
T
roytam1 9fcdd744ea import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1149486 - Regroup PerformanceStats by window. r=jandem, r=bholley (bedbaab6b)
- fix build.... we have a nwer GetScriptableTop() now... (d4c5b9833) (properly fixed by me)
- Bug 1167308 - Add a simpler to use CallTyped for the many simple pre-cast cases; r=jonco (73124e936)
- Bug 1167313 - Simplify UbiNode::construct dispatch using CallTyped; r=jimb (ce8e33fdd)
- Bug 1167314 - Use CallTyped to simplify PushArena; r=jonco (4e07c7a96)
- Bug 1167309 - Remove MaybeCompartment using CallTyped; r=jonco (b85699798)
- missing bits of bug 1156708: Part2. Add pref to toggle new code. (122a90f03)
- Bug 1164777 - Part 1: move evalStaticScope to GlobalSharedContext. (r=shu) (b38066072)
- Bug 1164777 - Part 2: Make super.prop parse inside inside eval inside arrow functions. (r=shu) (f7a2fc1fa)
- Bug 1141865 - Part 5: Implement new.target inside eval. (r=jorendorff, r=jandem) (4e558cb93)
- Bug 1141865 - Part 6: Implement new.target in arrow functions. (r=jandem, r=jorendorff) (f7694ad0b)
- Bug 1156264 - Activate/deactivate jank and CPOW monitoring separately (low-level). r=jandem (3837061f6)
- Bug 1150259 - Deactivating subtest under old Windows/old Linux. r=yoric (128dc82d4)
- Bug 1150514 - in about:performance, fixing CSS of jank levels. r=Yoric (136e06827)
- Bug 1150548 - MISBEHAVING_ADDONS_CPOW_TIME_MS is in milliseconds, but is filled with microseconds data. r=yoric (b477de514)
- Bug 1155355, e10s, rewrite and reenable browser tests in layout/xul/t#est, don't show tooltips during a drag, use system event listeners for tooltips, r=billm (858570301) (partly)
- Bug 1142814 (attempt 2) - Optimize String.fromCharCode() when the number of args is small but > 1. r=jandem. (7c03f649e)
and partly import changes from mozilla in order to fix build:
- Bug 1149486 - Extract a window title and window ID for PerformanceStats. r=mossop
- Bug 1156264 - Activate/deactivate jank and CPOW monitoring separately (high-level). r=mossop
2020-10-09 23:05:14 +08:00

40 lines
1.2 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=4 sw=4 et tw=80:
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "jsfriendapi.h"
#include "nsContentUtils.h"
#include "CPOWTimer.h"
CPOWTimer::CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(nullptr)
, startInterval_(0)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
JSRuntime* runtime = JS_GetRuntime(cx);
if (!js::GetStopwatchIsMonitoringCPOW(runtime))
return;
cx_ = cx;
startInterval_ = PR_IntervalNow();
}
CPOWTimer::~CPOWTimer()
{
if (!cx_) {
// Monitoring was off when we started the timer.
return;
}
JSRuntime* runtime = JS_GetRuntime(cx_);
if (!js::GetStopwatchIsMonitoringCPOW(runtime)) {
// Monitoring has been deactivated while we were in the timer.
return;
}
js::PerformanceData* performance = js::GetPerformanceData(runtime);
uint64_t duration = PR_IntervalToMicroseconds(PR_IntervalNow() - startInterval_);
performance->totalCPOWTime += duration;
}