抽动
Start stopwatch timer
Syntax
Description
抽动
适用于TOC
function to measure elapsed time. The抽动
function records the current time, and theTOC
function uses the recorded value to calculate the elapsed time.
Timerval= tic
stores the current time inTimerval
so that you can pass it explicitly to theTOC
function. Passing this value is useful when there are multiple calls to抽动
为了计时相同代码的不同部分。Timerval
is an integer that has meaning only for theTOC
function.
Examples
Tips
Consecutive calls to the
抽动
function overwrite the internally recorded starting time.The
清除
function does not reset the starting time recorded by a抽动
function call.有时程序运行太快了
抽动
和TOC
to provide useful data. If your code is faster than 1/10 second, consider measuring it running in a loop, and then average to find the time for a single run. For more information, seeMeasure the Performance of Your Code。以下操作导致意外输出:
- Using
抽动
和TOC
to timetimeit
- Using
抽动
和TOC
在一个定时的函数中timeit
- Using