Members
(static) accs
Timing accumulators.
(static) messages :Array.<string>
Timing messages - how long did each timer take?
Type:
(static) timers :Array.<Date>
A queue of timers.
Type:
Methods
(static) displayDate() → {string}
Get the current date as a string in the user's locale.
Returns:
Type | Description |
---|---|
string |
(static) end(label)
End the top timer on the queue.
Parameters:
Name | Type | Description |
---|---|---|
label |
string | A description of the timer. |
(static) endacc(name)
Stop accumulating runtime for a function.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
(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 |
(static) secsToMachineDuration(time) → {string}
Convert a number of seconds to an ISO8601 duration string in the format PdDThHmMsS
Parameters:
Name | Type | Description |
---|---|---|
time |
number |
Returns:
Type | Description |
---|---|
string |
(static) secsToUnits(time) → {duration}
Convert a number of seconds to an object with seconds, minutes, hours and days.
Parameters:
Name | Type | Description |
---|---|---|
time |
number |
Returns:
Type | Description |
---|---|
duration |
(static) show()
Show all timing messages through Numbas.debug
.
(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 |