API Documentation for: 1.0.1
Show:

ProfilerNode Class

Namespace: Canteen\Profiler

Class which represents the profiler steps

Constructor

ProfilerNode

(
  • profiler
  • name
  • depth
  • parentNode
  • profilerKey
)

Parameters:

  • profiler Profiler

    Reference to the profiler object

  • name String

    Name of this step

  • depth Int

    Tree depth of this step

  • parentNode ProfilerNode

    Reference to this step's parent. null if top-level.

  • profilerKey String

    API key to identify an internal API call from an external one.

Methods

addChild

(
  • childNode
)
ProfilerNode

Add child {@link ProfilerNode} to this node

Parameters:

Returns:

ProfilerNode:

Return a reference to this profiler node (for chaining)

addQueryDuration

(
  • time
)
ProfilerNode

Increment the total sql duration at this step

Parameters:

  • time Number

    amount of time to increment the SQL duration by, in microseconds

Returns:

ProfilerNode:

Return instance of this step, for chaining

end

(
  • [profilerKey=null]
)
Boolean | ProfilerNode

End the timer for this step. Call this after the code that is being profiled by this step has completed executing

Parameters:

  • [profilerKey=null] String optional

    This is for internal use only! don't ever pass anything!

Returns:

Boolean | ProfilerNode:

returns parent node, or null if there is no parent

getChildren

() Array

Get the children steps for this step

Returns:

Array:

List of {@link ProfilerNodes} that are the child of this node

getDepth

() Int

Return tree depth of this step

Returns:

Int:

Tree depth of this step

getEnd

() Number

Get the end time of this step in milliseconds

Returns:

Number:

End time of this step, in milliseconds, from unix epoch. (1 significant digit)

getName

() String

Return the name of this step

Returns:

String:

Name of this step

getParent

() Boolean | ProfilerNode

Return this step's parent node

Returns:

Boolean | ProfilerNode:

Returns {@link ProfilerNode} object for the parent node to this step, or null if there is no parent

getSelfDuration

() Number

Get the duration of execution for this step, excluding child nodes.

Returns:

Number:

Duration of this step, excluding child nodes. (1 significant digit)

getSQLQueries

() Array

Get all the SQL queries executed at this step

Returns:

Array:

list of {@link ProfilerSQLNode}s

getSQLQueryCount

() Int

Return number of queries run at this step

Returns:

Int:

number of queries run at this step

getStart

() Number

Get the start time of this step in milliseconds

Returns:

Number:

Start time of this step, in milliseconds, from unix epoch. (1 significant digit)

getTotalDuration

() Number

Get the total time spent executing this node, including children

Returns:

Number:

Duration of this step, in milliseconds. (1 significant digit)

getTotalSQLQueryDuration

() Number

Get the total duration for SQL queries executed at this step in milliseconds

Returns:

Number:

Duration of query time at this step, in milliseconds, 1 significant digit

hasChildren

() Boolean

Determine if this node has child steps or not

Returns:

Boolean:

True if this node has child steps, false otherwise

hasNonTrivialChildren

() Boolean

Determine if this node has trivial children. Traverse the tree of child steps until a non-trivial node is found. This is used at render time.

Returns:

Boolean:

False if all children are trivial, true if there's at least one non-trivial

hasSQLQueries

() Boolean

Determine if SQL queries were executed at this step

Returns:

Boolean:

True if there are queries, false if not

increaseChildDuration

(
  • time
)
Number

Increase the total time child steps have taken. Stored in microseconds

Parameters:

  • time Number

    Amount of time to add to the total child duration, in microseconds

Returns:

Number:

Return number total time child steps have taken, in microseconds

sqlStart

(
  • sqlProfile
)
ProfilerSQLNode

This method is called by the Profiler::sqlStart method

Parameters:

  • sqlProfile ProfilerSQLNode

    An instance of the {@link ProfilerSQLNode} to add to this step

Returns:

ProfilerSQLNode:

reference to the {@link ProfilerSQLNode} object for the query initiated

Properties

_profiler

Profiler private

Reference to the main profiler

childDuration

Number protected

Total time children steps spent running

childNodes

Array protected

List of this step's direct children

depth

Int protected

Tree depth of this step

ended

Number protected

Time the step ended. Stored as microseconds from the unix epoc.

name

String protected

Name of the step

parentNode

ProfilerNode protected

The parent step to this node

profilerKey

String protected

Local reference to profiler key generated at initialization

selfDuration

Number protected

Total time the step ran WITHOUT it's children

sqlQueries

Array protected

List of this step's SQL queries

sqlQueryCount

Int protected

Number of queries run at this step

started

Number protected

Time the step started. Stored as microseconds from the unix epoc.

totalDuration

Number protected

Total time the step ran INCLUDING it's children

totalSQLQueryDuration

Number protected

Total time spent performing SQL queries. Stored in microseconds