These methods are common and are available both on the server (Node.js
) and on the client (in browsers
).
Outputs debugging information to the console. This method returns nothing.
Parameter | Type | Description |
---|---|---|
value | * |
A value of any type. |
[comment] | string |
Additional explanatory comment to the displayed value. |
Run-time testing (RTT). Sets the control point in the code. Calculates the code execution time between two control points (in milliseconds). Displays the calculated value in the console.
Returns: number
- the calculated value.
Parameter | Type | Default | Description |
---|---|---|---|
[name] | string |
Starting point. |
An optional explanatory name for the control point. The default value is displayed only if the method is called the first time. |
Run-time testing (RTT). The starting point for computing the execution time of some code. This method returns nothing.
Parameter | Type | Default | Description |
---|---|---|---|
[name] | string |
An optional explanatory name for this test. | |
[levelIndex] | int |
0 |
An optional index for the level of nesting (for nested tests). |
Run-time testing (RTT).
The end point for the rttStart()
method.
Calculates the code execution time between the start and current points (in milliseconds).
Displays the calculated value in the console.
Returns: number
- the calculated value.
Parameter | Type | Default | Description |
---|---|---|---|
[levelIndex] | int |
0 |
An optional index for the level of nesting (for nested tests). |
Example of nested tests:
Debug.rttStart('The main level.', 0);
Debug.rttStart('The nested level.', 1);
// Some code.
Debug.rttFinish(1);
Debug.rttStart('The nested level.', 1);
// Some code.
Debug.rttFinish(1);
Debug.rttFinish(0);
Run-time testing (RTT). Calculates the average execution time of some code (in milliseconds). Displays the calculated value in the console.
Returns: number
- the calculated value.
Parameter | Type | Default | Description |
---|---|---|---|
codeContainer | function |
Container for the code under test. | |
cycles | int |
Number of cycles to repeat the test (maximum 1000 cycles). | |
[name] | string |
An optional explanatory name for this test. | |
[timeEachIteration] | boolean |
false |
Display the execution time of each iteration? |
The method stops execution of the utility. This method returns nothing.
The method resumes execution of the utility. This method returns nothing.