perf.js (2567B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 const { 7 Arg, 8 Option, 9 RetVal, 10 generateActorSpec, 11 BULK_RESPONSE, 12 } = require("resource://devtools/shared/protocol.js"); 13 14 const perfDescription = { 15 typeName: "perf", 16 17 events: { 18 "profiler-started": { 19 type: "profiler-started", 20 entries: Arg(0, "number"), 21 interval: Arg(1, "number"), 22 features: Arg(2, "number"), 23 duration: Arg(3, "nullable:number"), 24 // The `activeTabID` option passed to `profiler_start` is used to 25 // determine the active tab when user starts the profiler. 26 // This is a parameter that is generated on the 27 // server, that's why we don't need to pass anything on `startProfiler` 28 // actor method. But we return this in "profiler-started" event because 29 // client may want to use that value. 30 activeTabID: Arg(4, "number"), 31 }, 32 "profiler-stopped": { 33 type: "profiler-stopped", 34 }, 35 }, 36 37 methods: { 38 startProfiler: { 39 request: { 40 entries: Option(0, "number"), 41 duration: Option(0, "nullable:number"), 42 interval: Option(0, "number"), 43 features: Option(0, "array:string"), 44 threads: Option(0, "array:string"), 45 }, 46 response: { value: RetVal("boolean") }, 47 }, 48 49 startCaptureAndStopProfiler: { 50 request: {}, 51 response: { value: RetVal("number") }, 52 }, 53 54 getPreviouslyCapturedProfileDataBulk: { 55 request: { 56 handle: Arg(0, "number"), 57 }, 58 response: BULK_RESPONSE, 59 }, 60 61 getPreviouslyRetrievedAdditionalInformation: { 62 request: { 63 handle: Arg(0, "number"), 64 }, 65 response: { value: RetVal("nullable:json") }, 66 }, 67 68 stopProfilerAndDiscardProfile: { 69 request: {}, 70 response: {}, 71 }, 72 73 getSymbolTable: { 74 request: { 75 debugPath: Arg(0, "string"), 76 breakpadId: Arg(1, "string"), 77 }, 78 response: { value: RetVal("array:array:number") }, 79 }, 80 81 isActive: { 82 request: {}, 83 response: { value: RetVal("boolean") }, 84 }, 85 86 isSupportedPlatform: { 87 request: {}, 88 response: { value: RetVal("boolean") }, 89 }, 90 91 getSupportedFeatures: { 92 request: {}, 93 response: { value: RetVal("array:string") }, 94 }, 95 }, 96 }; 97 98 exports.perfDescription = perfDescription; 99 100 const perfSpec = generateActorSpec(perfDescription); 101 102 exports.perfSpec = perfSpec;