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: