CDPotion.Domain.Profiler (cdpotion v0.1.4)

Summary

Types

Coverage data for a source range.

Coverage data for a JavaScript function.

Specifies a number of samples attributed to a certain source position.

Profile.

Profile node. Holds callsite information, execution statistics and child nodes.

Coverage data for a JavaScript script.

Functions

Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.

Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.

Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.

Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.

Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.

Types

Link to this type

coverage_range()

@type coverage_range() :: %{
  count: integer(),
  endOffset: integer(),
  startOffset: integer()
}

Coverage data for a source range.

Link to this type

function_coverage()

@type function_coverage() :: %{
  functionName: String.t(),
  isBlockCoverage: boolean(),
  ranges: [coverage_range()]
}

Coverage data for a JavaScript function.

Link to this type

position_tick_info()

@type position_tick_info() :: %{line: integer(), ticks: integer()}

Specifies a number of samples attributed to a certain source position.

@type profile() :: %{
  endTime: number(),
  nodes: [profile_node()],
  samples: [integer()] | nil,
  startTime: number(),
  timeDeltas: [integer()] | nil
}

Profile.

Link to this type

profile_node()

@type profile_node() :: %{
  callFrame: CDPotion.Domain.Runtime.call_frame(),
  children: [integer()] | nil,
  deoptReason: String.t() | nil,
  hitCount: integer() | nil,
  id: integer(),
  positionTicks: [position_tick_info()] | nil
}

Profile node. Holds callsite information, execution statistics and child nodes.

Link to this type

script_coverage()

@type script_coverage() :: %{
  functions: [function_coverage()],
  scriptId: CDPotion.Domain.Runtime.script_id(),
  url: String.t()
}

Coverage data for a JavaScript script.

Functions

@spec disable() :: {String.t(), map()}
@spec enable() :: {String.t(), map()}
Link to this function

get_best_effort_coverage()

@spec get_best_effort_coverage() :: {String.t(), map()}

Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.

Link to this function

set_sampling_interval(interval)

@spec set_sampling_interval(integer()) :: {String.t(), map()}

Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.

Parameters:

  • (Required) interval: New sampling interval in microseconds.
@spec start() :: {String.t(), map()}
Link to this function

start_precise_coverage(call_count \\ nil, detailed \\ nil, allow_triggered_updates \\ nil)

@spec start_precise_coverage(boolean(), boolean(), boolean()) :: {String.t(), map()}

Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.

Parameters:

  • (Optional) call_count: Collect accurate call counts beyond simple 'covered' or 'not covered'.
  • (Optional) detailed: Collect block-based coverage.
  • (Optional) allow_triggered_updates: Allow the backend to send updates on its own initiative
@spec stop() :: {String.t(), map()}
Link to this function

stop_precise_coverage()

@spec stop_precise_coverage() :: {String.t(), map()}

Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.

Link to this function

take_precise_coverage()

@spec take_precise_coverage() :: {String.t(), map()}

Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.