зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1253994 - Make profile collection more robust (r=mconley)
This commit is contained in:
Родитель
e5edaae6df
Коммит
b8f8a4cdc6
|
@ -3138,6 +3138,27 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||||
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
|
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||||
|
// Need to do this before the mIsAlive check to avoid missing profiles.
|
||||||
|
if (!strcmp(aTopic, "profiler-subprocess-gather")) {
|
||||||
|
if (mGatherer) {
|
||||||
|
mGatherer->WillGatherOOPProfile();
|
||||||
|
if (mIsAlive && mSubprocess) {
|
||||||
|
Unused << SendGatherProfile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strcmp(aTopic, "profiler-subprocess")) {
|
||||||
|
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
|
||||||
|
if (pse) {
|
||||||
|
if (!mProfile.IsEmpty()) {
|
||||||
|
pse->AddSubProfile(mProfile.get());
|
||||||
|
mProfile.Truncate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!mIsAlive || !mSubprocess)
|
if (!mIsAlive || !mSubprocess)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
@ -3299,21 +3320,6 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||||
else if (!strcmp(aTopic, "profiler-resumed")) {
|
else if (!strcmp(aTopic, "profiler-resumed")) {
|
||||||
Unused << SendPauseProfiler(false);
|
Unused << SendPauseProfiler(false);
|
||||||
}
|
}
|
||||||
else if (!strcmp(aTopic, "profiler-subprocess-gather")) {
|
|
||||||
if (mGatherer) {
|
|
||||||
mGatherer->WillGatherOOPProfile();
|
|
||||||
Unused << SendGatherProfile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!strcmp(aTopic, "profiler-subprocess")) {
|
|
||||||
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
|
|
||||||
if (pse) {
|
|
||||||
if (!mProfile.IsEmpty()) {
|
|
||||||
pse->AddSubProfile(mProfile.get());
|
|
||||||
mProfile.Truncate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp(aTopic, "gmp-changed")) {
|
else if (!strcmp(aTopic, "gmp-changed")) {
|
||||||
Unused << SendNotifyGMPsChanged();
|
Unused << SendNotifyGMPsChanged();
|
||||||
|
|
|
@ -104,6 +104,43 @@ var Profiler;
|
||||||
_profiler.StopProfiler();
|
_profiler.StopProfiler();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
finishTestAsync: function Profiler__finishTest () {
|
||||||
|
if (!(_profiler && enabled)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
Services.profiler.getProfileDataAsync().then((profile) => {
|
||||||
|
let profileFile = profiler_dir + "/" + currentTest + ".sps";
|
||||||
|
|
||||||
|
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||||
|
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||||
|
|
||||||
|
var file = Components.classes["@mozilla.org/file/local;1"].
|
||||||
|
createInstance(Components.interfaces.nsILocalFile);
|
||||||
|
file.initWithPath(profileFile);
|
||||||
|
|
||||||
|
var ostream = FileUtils.openSafeFileOutputStream(file);
|
||||||
|
|
||||||
|
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
|
||||||
|
createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
|
||||||
|
converter.charset = "UTF-8";
|
||||||
|
var istream = converter.convertToInputStream(JSON.stringify(profile));
|
||||||
|
|
||||||
|
// The last argument (the callback) is optional.
|
||||||
|
NetUtil.asyncCopy(istream, ostream, function(status) {
|
||||||
|
if (!Components.isSuccessCode(status)) {
|
||||||
|
reject();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}, (error) => {
|
||||||
|
Cu.reportError("Failed to gather profile: " + error);
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
||||||
if (_profiler && enabled) {
|
if (_profiler && enabled) {
|
||||||
_profiler.dumpProfileToFile(profiler_dir + "/startup.sps");
|
_profiler.dumpProfileToFile(profiler_dir + "/startup.sps");
|
||||||
|
|
|
@ -466,7 +466,7 @@ var plNextPage = Task.async(function*() {
|
||||||
doNextPage = true;
|
doNextPage = true;
|
||||||
} else {
|
} else {
|
||||||
if (profilingInfo) {
|
if (profilingInfo) {
|
||||||
Profiler.finishTest();
|
yield Profiler.finishTestAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageIndex < pages.length-1) {
|
if (pageIndex < pages.length-1) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||||
<Description about="urn:mozilla:install-manifest">
|
<Description about="urn:mozilla:install-manifest">
|
||||||
<em:id>pageloader@mozilla.org</em:id>
|
<em:id>pageloader@mozilla.org</em:id>
|
||||||
<em:version>1.0.4</em:version>
|
<em:version>1.0.5</em:version>
|
||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||||
|
|
Двоичные данные
testing/talos/talos/pageloader/pageloader-signed.xpi
Двоичные данные
testing/talos/talos/pageloader/pageloader-signed.xpi
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче