зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1447338 - Add thread "responsiveness" as a configurable feature to the Gecko Profiler; r=mstange
MozReview-Commit-ID: KTJRvQzUwsf --HG-- extra : rebase_source : 8692309978447fcccb2b6463c15fccda23cd3069
This commit is contained in:
Родитель
8b89b31d17
Коммит
e642a3ee41
|
@ -29,6 +29,7 @@
|
||||||
"mainthreadio",
|
"mainthreadio",
|
||||||
"memory",
|
"memory",
|
||||||
"privacy",
|
"privacy",
|
||||||
|
"responsiveness",
|
||||||
"restyle",
|
"restyle",
|
||||||
"screenshots",
|
"screenshots",
|
||||||
"stackwalk",
|
"stackwalk",
|
||||||
|
|
|
@ -95,6 +95,12 @@ const featureCheckboxes = [
|
||||||
title: "Record JavaScript stack information, and interleave it with native stacks.",
|
title: "Record JavaScript stack information, and interleave it with native stacks.",
|
||||||
recommended: true
|
recommended: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Responsiveness",
|
||||||
|
value: "responsiveness",
|
||||||
|
title: "Collect thread responsiveness information.",
|
||||||
|
recommended: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Java",
|
name: "Java",
|
||||||
value: "java",
|
value: "java",
|
||||||
|
|
|
@ -88,7 +88,7 @@ function entries(state = 10000000, action) {
|
||||||
* The features that are enabled for the profiler.
|
* The features that are enabled for the profiler.
|
||||||
* @param {array} state
|
* @param {array} state
|
||||||
*/
|
*/
|
||||||
function features(state = ["js", "stackwalk"], action) {
|
function features(state = ["js", "stackwalk", "responsiveness"], action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "CHANGE_FEATURES":
|
case "CHANGE_FEATURES":
|
||||||
return action.features;
|
return action.features;
|
||||||
|
|
|
@ -55,7 +55,8 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, {
|
||||||
const settings = {
|
const settings = {
|
||||||
entries: options.entries || 1000000,
|
entries: options.entries || 1000000,
|
||||||
interval: options.interval || 1,
|
interval: options.interval || 1,
|
||||||
features: options.features || ["js", "stackwalk", "threads", "leaf"],
|
features: options.features ||
|
||||||
|
["js", "stackwalk", "responsiveness", "threads", "leaf"],
|
||||||
threads: options.threads || ["GeckoMain", "Compositor"]
|
threads: options.threads || ["GeckoMain", "Compositor"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ProfiledThreadData::ProfiledThreadData(ThreadInfo* aThreadInfo,
|
ProfiledThreadData::ProfiledThreadData(ThreadInfo* aThreadInfo,
|
||||||
nsIEventTarget* aEventTarget)
|
nsIEventTarget* aEventTarget,
|
||||||
|
bool aIncludeResponsiveness)
|
||||||
: mThreadInfo(aThreadInfo)
|
: mThreadInfo(aThreadInfo)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ProfiledThreadData);
|
MOZ_COUNT_CTOR(ProfiledThreadData);
|
||||||
mResponsiveness.emplace(aEventTarget, aThreadInfo->IsMainThread());
|
if (aIncludeResponsiveness) {
|
||||||
|
mResponsiveness.emplace(aEventTarget, aThreadInfo->IsMainThread());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfiledThreadData::~ProfiledThreadData()
|
ProfiledThreadData::~ProfiledThreadData()
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
class ProfiledThreadData final
|
class ProfiledThreadData final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProfiledThreadData(ThreadInfo* aThreadInfo, nsIEventTarget* aEventTarget);
|
ProfiledThreadData(ThreadInfo* aThreadInfo, nsIEventTarget* aEventTarget,
|
||||||
|
bool aIncludeResponsiveness);
|
||||||
~ProfiledThreadData();
|
~ProfiledThreadData();
|
||||||
|
|
||||||
void NotifyUnregistered(uint64_t aBufferPosition)
|
void NotifyUnregistered(uint64_t aBufferPosition)
|
||||||
|
@ -63,8 +64,8 @@ public:
|
||||||
const mozilla::TimeStamp& aProcessStartTime,
|
const mozilla::TimeStamp& aProcessStartTime,
|
||||||
double aSinceTime);
|
double aSinceTime);
|
||||||
|
|
||||||
// Returns nullptr if this is not the main thread or if this thread is not
|
// Returns nullptr if this is not the main thread, the responsiveness
|
||||||
// being profiled.
|
// feature is not turned on, or if this thread is not being profiled.
|
||||||
ThreadResponsiveness* GetThreadResponsiveness()
|
ThreadResponsiveness* GetThreadResponsiveness()
|
||||||
{
|
{
|
||||||
ThreadResponsiveness* responsiveness = mResponsiveness.ptrOr(nullptr);
|
ThreadResponsiveness* responsiveness = mResponsiveness.ptrOr(nullptr);
|
||||||
|
|
|
@ -1794,7 +1794,8 @@ locked_profiler_stream_json_for_this_process(PSLockRef aLock,
|
||||||
// java thread, we have to get thread id and name via JNI.
|
// java thread, we have to get thread id and name via JNI.
|
||||||
RefPtr<ThreadInfo> threadInfo =
|
RefPtr<ThreadInfo> threadInfo =
|
||||||
new ThreadInfo("Java Main Thread", 0, false);
|
new ThreadInfo("Java Main Thread", 0, false);
|
||||||
ProfiledThreadData profiledThreadData(threadInfo, nullptr);
|
ProfiledThreadData profiledThreadData(threadInfo, nullptr,
|
||||||
|
ActivePS::FeatureResponsiveness(aLock));
|
||||||
profiledThreadData.StreamJSON(*javaBuffer.get(), nullptr, aWriter,
|
profiledThreadData.StreamJSON(*javaBuffer.get(), nullptr, aWriter,
|
||||||
CorePS::ProcessStartTime(), aSinceTime);
|
CorePS::ProcessStartTime(), aSinceTime);
|
||||||
|
|
||||||
|
@ -2089,7 +2090,10 @@ SamplerThread::Run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
profiledThreadData->GetThreadResponsiveness()->Update();
|
ThreadResponsiveness* resp = profiledThreadData->GetThreadResponsiveness();
|
||||||
|
if (resp) {
|
||||||
|
resp->Update();
|
||||||
|
}
|
||||||
|
|
||||||
TimeStamp now = TimeStamp::Now();
|
TimeStamp now = TimeStamp::Now();
|
||||||
SuspendAndSampleAndResumeThread(lock, *registeredThread,
|
SuspendAndSampleAndResumeThread(lock, *registeredThread,
|
||||||
|
@ -2269,7 +2273,8 @@ locked_register_thread(PSLockRef aLock, const char* aName, void* aStackTop)
|
||||||
nsCOMPtr<nsIEventTarget> eventTarget = registeredThread->GetEventTarget();
|
nsCOMPtr<nsIEventTarget> eventTarget = registeredThread->GetEventTarget();
|
||||||
ProfiledThreadData* profiledThreadData =
|
ProfiledThreadData* profiledThreadData =
|
||||||
ActivePS::AddLiveProfiledThread(aLock, registeredThread.get(),
|
ActivePS::AddLiveProfiledThread(aLock, registeredThread.get(),
|
||||||
MakeUnique<ProfiledThreadData>(info, eventTarget));
|
MakeUnique<ProfiledThreadData>(info, eventTarget,
|
||||||
|
ActivePS::FeatureResponsiveness(aLock)));
|
||||||
|
|
||||||
if (ActivePS::FeatureJS(aLock)) {
|
if (ActivePS::FeatureJS(aLock)) {
|
||||||
// This StartJSSampling() call is on-thread, so we can poll manually to
|
// This StartJSSampling() call is on-thread, so we can poll manually to
|
||||||
|
@ -2871,7 +2876,8 @@ locked_profiler_start(PSLockRef aLock, uint32_t aEntries, double aInterval,
|
||||||
nsCOMPtr<nsIEventTarget> eventTarget = registeredThread->GetEventTarget();
|
nsCOMPtr<nsIEventTarget> eventTarget = registeredThread->GetEventTarget();
|
||||||
ProfiledThreadData* profiledThreadData =
|
ProfiledThreadData* profiledThreadData =
|
||||||
ActivePS::AddLiveProfiledThread(aLock, registeredThread.get(),
|
ActivePS::AddLiveProfiledThread(aLock, registeredThread.get(),
|
||||||
MakeUnique<ProfiledThreadData>(info, eventTarget));
|
MakeUnique<ProfiledThreadData>(info, eventTarget,
|
||||||
|
ActivePS::FeatureResponsiveness(aLock)));
|
||||||
if (ActivePS::FeatureJS(aLock)) {
|
if (ActivePS::FeatureJS(aLock)) {
|
||||||
registeredThread->StartJSSampling(
|
registeredThread->StartJSSampling(
|
||||||
ActivePS::FeatureTrackOptimizations(aLock));
|
ActivePS::FeatureTrackOptimizations(aLock));
|
||||||
|
|
|
@ -122,8 +122,11 @@ class TimeStamp;
|
||||||
/* Do not include user-identifiable information. */ \
|
/* Do not include user-identifiable information. */ \
|
||||||
macro(5, "privacy", Privacy) \
|
macro(5, "privacy", Privacy) \
|
||||||
\
|
\
|
||||||
|
/* Collect thread responsiveness information. */ \
|
||||||
|
macro(6, "responsiveness", Responsiveness) \
|
||||||
|
\
|
||||||
/* Restyle profiling. */ \
|
/* Restyle profiling. */ \
|
||||||
macro(6, "restyle", Restyle) \
|
macro(7, "restyle", Restyle) \
|
||||||
\
|
\
|
||||||
/* Take a snapshot of the window on every composition. */ \
|
/* Take a snapshot of the window on every composition. */ \
|
||||||
macro(7, "screenshots", Screenshots) \
|
macro(7, "screenshots", Screenshots) \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче