|
1 | 1 | """ |
2 | 2 | This module provides `tick()`, `tock()`, and `tok()` functions. |
3 | 3 |
|
4 | | -They're similar to the `tic()`, `toc()`, and `toq()` functions that you might find in MATLAB and |
5 | | -similar software. |
| 4 | +They're similar to the `tic()`, `toc()`, and `toq()` functions that you might find in MATLAB |
| 5 | +and similar software. |
6 | 6 |
|
7 | 7 | Don't use these for timing code execution! Julia provides much better facilities for |
8 | | -measuring performance, ranging from the `@time` and `@elapsed` macros to packages such as [BenchmarkTools.jl](https://github.com/JuliaCI/BenchmarkTools.jl). (And remember, don't |
| 8 | +measuring performance, ranging from the `@time` and `@elapsed` macros to packages such as |
| 9 | +[BenchmarkTools.jl](https://github.com/JuliaCI/BenchmarkTools.jl). (And remember, don't |
9 | 10 | time Julia code running in global scope!) |
10 | 11 |
|
11 | | -This code used to live in Julia Base in the `tic()`, `toc()`, and `toq()` functions (in base/util.jl). They were deprecated in GitHub issue [17046](https://github.com/JuliaLang/julia/issues/17046). |
| 12 | +This code used to live in Julia Base as the `tic()`, `toc()`, and `toq()` functions |
| 13 | +(in base/util.jl). They were deprecated in GitHub issue [17046](https://github.com/JuliaLang/julia/issues/17046). |
12 | 14 | """ |
13 | 15 |
|
14 | 16 | module TickTock |
|
22 | 24 | """ |
23 | 25 | tick() |
24 | 26 |
|
25 | | -Start counting. |
| 27 | +Start counting. The other functions are: |
| 28 | +
|
| 29 | +- `tock()` stop counting, show total elapsed time in canonical form |
| 30 | +- `tok()` stop counting, return seconds |
| 31 | +- `peek()` continue counting, return elapsed seconds |
| 32 | +- `lap()` continue counting, show total elapsed time in canonical form |
26 | 33 | """ |
27 | 34 | function tick() |
28 | 35 | t0 = time_ns() |
|
33 | 40 | """ |
34 | 41 | peek() |
35 | 42 |
|
36 | | -Return the seconds counted by the current timer, without stopping it. |
| 43 | +Return the current elapsed seconds counted by the current timer, without stopping it. |
37 | 44 | """ |
38 | 45 | function peek() |
39 | 46 | t1 = time_ns() |
|
0 commit comments