diff --git a/devtools/server/actors/perf.js b/devtools/server/actors/perf.js index 76a5eafddbe4..60b565c287ba 100644 --- a/devtools/server/actors/perf.js +++ b/devtools/server/actors/perf.js @@ -45,7 +45,7 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, { Actor.prototype.destroy.call(this); }, - startProfiler() { + startProfiler(options) { if (!IS_SUPPORTED_PLATFORM) { return false; } @@ -53,10 +53,10 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, { // 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 { @@ -141,6 +141,9 @@ exports.PerfActor = ActorClassWithSpec(perfSpec, { this.emit("profile-unlocked-from-private-browsing"); break; case "profiler-started": + let param = subject.QueryInterface(Ci.nsIProfilerStartParams); + this.emit(topic, param.entries, param.interval, param.features); + break; case "profiler-stopped": this.emit(topic); break; diff --git a/devtools/shared/specs/perf.js b/devtools/shared/specs/perf.js index f60904dd6397..d82a4012dfac 100644 --- a/devtools/shared/specs/perf.js +++ b/devtools/shared/specs/perf.js @@ -3,14 +3,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { RetVal, generateActorSpec } = require("devtools/shared/protocol"); +const { Arg, Option, RetVal, generateActorSpec } = require("devtools/shared/protocol"); const perfDescription = { typeName: "perf", events: { "profiler-started": { - type: "profiler-started" + type: "profiler-started", + entries: Arg(0, "number"), + interval: Arg(1, "number"), + features: Arg(2, "number"), }, "profiler-stopped": { type: "profiler-stopped" @@ -25,7 +28,12 @@ const perfDescription = { 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") } },