Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "profiling"

Contains contains utility methods for profiling. All methods in this module are experimental and may be changed in a non-major version.

Index

Type aliases

InstrumentationMode

InstrumentationMode: "counters" | "timeline"

Profiling mode to use.

  • counters Accumulates method call counts and times until dumpProfiles is called and then prints agregated statistic in the console. This is the default.
  • timeline Outputs method names along start/end timestamps in the console on the go.

Functions

disable

  • disable(): void

dumpProfiles

  • dumpProfiles(): void

enable

  • Enables profiling.

    Upon loading of the module it will cache the package.json of the app and check if there is a "profiling" key set, its value can be one of the options available for InstrumentationMode, and if set, enable() will be called in pre app start with the value in the package.json.

    An example for an app/package.json enabling the manual instrumentation profiling is:

    {
        "main": "main.js",
        "profiling": "timeline"
    }
    

    Parameters

    • Optional type: InstrumentationMode

      Profiling mode to use.

      • "counters" - Accumulates method call counts and times until dumpProfiles is called and then prints agregated statistic in the console. This is the default.
      • "timeline" - Outputs method names along start/end timestamps in the console on the go.

    Returns void

isRunning

  • isRunning(name: string): boolean
  • Returns true if a timer is currently running.

    Parameters

    • name: string

      Name of the timer.

    Returns boolean

    true is the timer is currently running.

profile

  • profile(name?: string): MethodDecorator
  • profile<F>(fn: F): F
  • profile<F>(name: string, fn: F): F
  • profile<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void
  • profile(): any
  • Method decorator factory. It will intercept the method call and start and pause a timer before and after the method call. Works only if profiling is enabled.

    Parameters

    • Optional name: string

      Name of the timer which will be used for method calls. If not provided - the name of the method will be used.

    Returns MethodDecorator

  • Function factory. It will intercept the function call and start and pause a timer before and after the function call. Works only if profiling is enabled. Works only if profiling is enabled.

    Type parameters

    • F: Function

    Parameters

    • fn: F

      The function to wrap. Uses the function name to track the times.

    Returns F

  • Function factory. It will intercept the function call and start and pause a timer before and after the function call. Works only if profiling is enabled.

    Type parameters

    • F: Function

    Parameters

    • name: string

      The name used to track calls and times.

    • fn: F

      The function to wrap.

    Returns F

  • Method decorator. It will intercept the method calls and start and pause a timer before and after the method call. Works only if profiling is enabled.

    Type parameters

    • T

    Parameters

    • target: Object
    • propertyKey: string | symbol
    • descriptor: TypedPropertyDescriptor<T>

    Returns TypedPropertyDescriptor<T> | void

  • Returns any

resetProfiles

  • resetProfiles(): void

start

  • start(name: string): void
  • Starts a timer with a specific name. Works only if profiling is enabled.

    Parameters

    • name: string

      Name of the timer.

    Returns void

startCPUProfile

  • startCPUProfile(name: string): void
  • Starts android cpu profiling.

    Parameters

    • name: string

      Name of the cpu profiling session.

    Returns void

stop

  • Pauses a timer with a specific name. This will increase call count and accumulate time. Works only if profiling is enabled.

    Parameters

    • name: string

      Name of the timer.

    Returns TimerInfo

    TimerInfo for the paused timer.

stopCPUProfile

  • stopCPUProfile(name: string): void
  • Stops android cpu profiling.

    Parameters

    • name: string

      Name of the cpu profiling session.

    Returns void

time

  • time(): number

timer

uptime

  • uptime(): number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method