Bug 1444796 - Part 1. Add options to startProfiler to customize profiler parameter from remote. r?gregtatum
New remote profiler protocol uses perfActor, but startProfiler doesn't support
parameters such as interval, So perfActor should support parameters for
startProfiler.
MozReview-Commit-ID: 3QiNunLyhnf
--- a/devtools/server/actors/perf.js
+++ b/devtools/server/actors/perf.js
@@ -40,28 +40,28 @@ exports.PerfActor = ActorClassWithSpec(p
}
Services.obs.removeObserver(this._observer, "profiler-started");
Services.obs.removeObserver(this._observer, "profiler-stopped");
Services.obs.removeObserver(this._observer, "chrome-document-global-created");
Services.obs.removeObserver(this._observer, "last-pb-context-exited");
Actor.prototype.destroy.call(this);
},
- startProfiler() {
+ startProfiler(options) {
if (!IS_SUPPORTED_PLATFORM) {
return false;
}
// For a quick implementation, decide on some default values. These may need
// to be tweaked or made configurable as needed.
const settings = {
- entries: 1000000,
- interval: 1,
- features: ["js", "stackwalk", "threads", "leaf"],
- threads: ["GeckoMain", "Compositor"]
+ entries: options.entries || 1000000,
+ interval: options.interval || 1,
+ features: options.features || ["js", "stackwalk", "threads", "leaf"],
+ threads: options.threads || ["GeckoMain", "Compositor"]
};
try {
// This can throw an error if the profiler is in the wrong state.
Services.profiler.StartProfiler(
settings.entries,
settings.interval,
settings.features,
--- a/devtools/shared/specs/perf.js
+++ b/devtools/shared/specs/perf.js
@@ -1,14 +1,14 @@
/* 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/. */
"use strict";
-const { RetVal, generateActorSpec } = require("devtools/shared/protocol");
+const { Option, RetVal, generateActorSpec } = require("devtools/shared/protocol");
const perfDescription = {
typeName: "perf",
events: {
"profiler-started": {
type: "profiler-started"
},
@@ -20,17 +20,22 @@ const perfDescription = {
},
"profile-unlocked-from-private-browsing": {
type: "profile-unlocked-from-private-browsing"
}
},
methods: {
startProfiler: {
- request: {},
+ request: {
+ entries: Option(0, "number"),
+ interval: Option(0, "number"),
+ features: Option(0, "array:string"),
+ threads: Option(0, "array:string"),
+ },
response: { value: RetVal("boolean") }
},
/**
* Returns null when unable to return the profile.
*/
getProfileAndStopProfiler: {
request: {},