Bug 1329114 - Put profiles from other processes into a 'processes' array, not into the threads array, and don't stringify them. r=njn

MozReview-Commit-ID: Ccl6JIbRMyX

--HG--
extra : rebase_source : 1b9a5bbff6da5b1dbfb907630900526e95981a28
extra : histedit_source : 8c830a0178c14fdb044dea2c7323025d3892454b
This commit is contained in:
Markus Stange 2017-04-08 16:00:30 -04:00
Родитель 7463009e1d
Коммит dc05eb93fd
1 изменённых файлов: 23 добавлений и 20 удалений

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

@ -1222,7 +1222,7 @@ StreamMetaJSCustomObject(PS::LockRef aLock, SpliceableJSONWriter& aWriter)
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
aWriter.IntProperty("version", 4);
aWriter.IntProperty("version", 5);
aWriter.DoubleProperty("interval", gPS->Interval(aLock));
aWriter.IntProperty("stackwalk", gPS->FeatureStackWalk(aLock));
@ -1309,8 +1309,9 @@ SubProcessCallback(const char* aProfile, void* aClosure)
// Called by the observer to get their profile data included as a sub profile.
SubprocessClosure* closure = (SubprocessClosure*)aClosure;
// Add the string profile into the profile.
closure->mWriter->StringElement(aProfile);
// Add the subprocess profile into the profile, as an element in the
// "processes" array.
closure->mWriter->Splice(aProfile);
}
#if defined(PROFILE_JAVA)
@ -1420,23 +1421,6 @@ StreamJSON(PS::LockRef aLock, SpliceableJSONWriter& aWriter, double aSinceTime)
aSinceTime);
}
// When notifying observers in other places in this file we are careful
// to do it when gPSMutex is unlocked, to avoid deadlocks. But that's not
// necessary here, because "profiler-subprocess" observers just call back
// into SubprocessCallback, which is simple and doesn't lock gPSMutex.
if (CanNotifyObservers()) {
// Send a event asking any subprocesses (plugins) to
// give us their information
SubprocessClosure closure(&aWriter);
nsCOMPtr<nsIObserverService> os =
mozilla::services::GetObserverService();
if (os) {
RefPtr<ProfileSaveEvent> pse =
new ProfileSaveEvent(SubProcessCallback, &closure);
os->NotifyObservers(pse, "profiler-subprocess", nullptr);
}
}
#if defined(PROFILE_JAVA)
if (gPS->FeatureJava(aLock)) {
java::GeckoJavaSampler::Pause();
@ -1454,6 +1438,25 @@ StreamJSON(PS::LockRef aLock, SpliceableJSONWriter& aWriter, double aSinceTime)
gPS->SetIsPaused(aLock, false);
}
aWriter.EndArray();
aWriter.StartArrayProperty("processes");
// When notifying observers in other places in this file we are careful
// to do it when gPSMutex is unlocked, to avoid deadlocks. But that's not
// necessary here, because "profiler-subprocess" observers just call back
// into SubprocessCallback, which is simple and doesn't lock gPSMutex.
if (CanNotifyObservers()) {
// Send a event asking any subprocesses (plugins) to
// give us their information
SubprocessClosure closure(&aWriter);
nsCOMPtr<nsIObserverService> os =
mozilla::services::GetObserverService();
if (os) {
RefPtr<ProfileSaveEvent> pse =
new ProfileSaveEvent(SubProcessCallback, &closure);
os->NotifyObservers(pse, "profiler-subprocess", nullptr);
}
}
aWriter.EndArray();
}
aWriter.End();
}