зеркало из https://github.com/mozilla/gecko-dev.git
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. nsIProfiler emit profiler-started event with parameters, but perfActor doesn't set the parameter yet. For unit test, we should set parameter on profiler-started event. MozReview-Commit-ID: 3QiNunLyhnf --HG-- extra : rebase_source : 836f67d2f161816c9947a47a18f912dad77728bf
This commit is contained in:
Родитель
77a473cd66
Коммит
344ae3712c
|
@ -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;
|
||||
|
|
|
@ -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") }
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче