Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Latest commit

 

History

History
152 lines (104 loc) · 5.59 KB

profiler.md

File metadata and controls

152 lines (104 loc) · 5.59 KB

Table of Contents

Profiler

Extends Actor

Main interface for interacting with nsIProfiler

startProfiler

Starts the nsIProfiler module. Doing so will discard any samples that might have been accumulated so far.

Parameters

  • entries Number number of entries
  • interval Number recording interval
  • features Array<String> list of features to include
  • threadFilters Array<String> list of thread filters

Returns Promise.Object request response

stopProfiler

Attempts to stop the nsIProfiler module.

Returns Promise.Object request response

getProfile

Returns all the samples accumulated since the profiler was started, along with the current time. The data has the following format: { libs: string, meta: { interval: number, platform: string, ... }, threads: [{ samples: [{ frames: [{ line: number, location: string, category: number } ... ], name: string responsiveness: number time: number } ... ] } ... ] }

Parameters

  • startTime Number Since the circular buffer will only grow as long as the profiler lives, the buffer can contain unwanted samples. Pass in a startTime to only retrieve samples that took place after the startTime, with 0 being when the profiler just started.
  • stringify Boolean Whether or not the returned profile object should be a string or not to save JSON parse/stringify cycle if emitting over RDP.

getFeatures

Returns an array of feature strings, describing the profiler features that are available on this platform. Can be called while the profiler is stopped.

Returns Array<Promise.String> list of feature strings

getBufferInfo

Returns an object with the values of the current status of the circular buffer in the profiler, returning position, totalSize, and the current generation of the buffer.

Returns Promise.Object current status of the circular buffer

getStartOptions

Returns the configuration used that was originally passed in to start up the profiler. Used for tests, and does not account for others using nsIProfiler.

Returns Promise.Object profiler configurations

isActive

Verifies whether or not the nsIProfiler module has started. If already active, the current time is also returned.

Returns Promise.Boolean true if nsIProfiler module has started

sharedLibraries

Returns an array of objects that describes the shared libraries which are currently loaded into our process. Can be called while the profiler is stopped.

Returns Array<Promise.Object> list of objects that describes the shared libraries

registerEventNotifications

Registers handlers for the following events to be emitted on active Profiler instances:

  • "console-api-profiler"
  • "profiler-started"
  • "profiler-stopped"
  • "profiler-status"

The ProfilerManager listens to all events, and individual consumers filter which events they are interested in.

Parameters

Returns Promise request response

unregisterEventNotifications

Unregisters handlers for all system events.

Parameters

Returns Promise request response

setProfilerStatusInterval

Updates the frequency that the "profiler-status" event is emitted during recording.

Parameters

  • interval Number interval of recording