Jump to navigation

Namespace: timing

Numbas.timing

Members

(static) accs

Timing accumulators.

Source:
See:

(static) messages :Array.<string>

Timing messages - how long did each timer take?

Type:
Source:

(static) timers :Array.<Date>

A queue of timers.

Type:
Source:

Methods

(static) displayDate() → {string}

Get the current date as a string in the user's locale.

Returns:
Type Description
string
Source:

(static) end(label)

End the top timer on the queue.

Parameters:
Name Type Description
label string

A description of the timer.

Source:

(static) endacc(name)

Stop accumulating runtime for a function.

Parameters:
Name Type Description
name string
Source:
See:

(static) secsToDisplayTime(time) → {string}

Convert a number of seconds to a string in HH:MM:SS format.

Parameters:
Name Type Description
time number
Returns:
Type Description
string
Source:

(static) show()

Show all timing messages through Numbas.debug.

Source:

(static) start()

Start a new timer.

Source:
See:

(static) startacc(name)

Accumulators are for counting time spent in functions which don't take long to evaluate, but are called repeatedly.

Call this with the function's name when you start the function, and Numbas.timing.endacc with the same name just before returning a value.

It copes with recursion automatically, so you don't need to worry about double counting.

Parameters:
Name Type Description
name string
Source:

(static) stress(f, times)

Stress test a function by running it a lot of times and seeing how long it takes.

Parameters:
Name Type Description
f function
times number
Source: