Skip to content

Commit ceac465

Browse files
committed
update docstrings
1 parent 93f41d1 commit ceac465

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
![tick tock](images/ticktock.gif)
44

5-
65
| **PackageEvaluator** | **Build Status** |
76
|:---:|:---:|
87
|[![][pkg-0.6-img]][pkg-0.6-url] [![][pkg-0.7-img]][pkg-0.7-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][codecov-img]][codecov-url] |
98

10-
This module provides `tick()`, `tock()`, and `tok()` functions. They're similar to the `tic()`, `toc()`, and `toq()` functions that you might find in other technical software. There are also `laptimer()` and `peektimer()` functions that show you current timing activity without stopping any active timers.
9+
This module provides simple timer functions:
10+
11+
- `tick()` start a timer
12+
- `tock()` stop a timer, show total elapsed time
13+
- `tok()` stop a timer, return elapsed seconds
14+
- `laptimer()` continue timing, show total elapsed time of active timers
15+
- `peektimer()` continue timing, return elapsed seconds of most recent timer
1116

12-
**Don't use these for timing code execution!** Julia provides much better facilities for 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 time Julia code running in global scope!) The [TimerOutputs.jl](https://github.com/KristofferC/TimerOutputs.jl) package provides tools for timing different sections of a program.
17+
`laptimer()` and `peektimer()` functions show your current timing activity without stopping any active timers.
1318

14-
## Functions
19+
**Don't use these for timing code execution!**
1520

16-
- `tick()` start a timer
17-
- `tock()` stop a timer, show total elapsed time
18-
- `tok()` stop a timer, return elapsed seconds
19-
- `peektimer() ` continue timing, return elapsed seconds of most recent timer
20-
- `laptimer() ` continue timing, show total elapsed time of active timers
21+
Julia provides much better facilities for 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 time Julia code running in global scope!) The [TimerOutputs.jl](https://github.com/KristofferC/TimerOutputs.jl) package provides tools for timing different sections of a program.
2122

2223
## Suggestions for use
2324

@@ -93,12 +94,11 @@ Some of this code used to live in Julia Base in the `tic()`, `toc()`, and `toq()
9394

9495
[appveyor-img]: https://ci.appveyor.com/api/projects/status/j4w1iwued4ojsfm6?svg=true
9596
[appveyor-url]: https://ci.appveyor.com/project/cormullion/ticktock-jl/branch/master
96-
97+
9798
[codecov-img]: https://codecov.io/github/cormullion/TickTock.jl/coverage.svg?branch=master
9899
[codecov-url]: https://codecov.io/github/cormullion/TickTock.jl
99100

100101
[pkg-0.6-img]: http://pkg.julialang.org/badges/TickTock_0.6.svg
101102
[pkg-0.6-url]: http://pkg.julialang.org/?pkg=TickTock&ver=0.6
102103
[pkg-0.7-img]: http://pkg.julialang.org/badges/TickTock_0.7.svg
103104
[pkg-0.7-url]: http://pkg.julialang.org/?pkg=TickTock&ver=0.7
104-

src/TickTock.jl

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
"""
22
This module provides `tick()`, `tock()`, and `tok()` functions.
33
4-
They're similar to the `tic()`, `toc()`, and `toq()` functions that you might find in MATLAB
5-
and similar software.
4+
- `tick()` ` start a new timer and start counting
5+
- `tock()` ` stop counting, show total elapsed time in canonical form
6+
- `tok()` ` stop counting, show and return total elapsed time in seconds
7+
- `peektimer() ` continue counting, show and return elapsed seconds so far
8+
- `laptimer() ` continue counting, show elapsed time so far in canonical form
69
710
Don't use these for timing code execution! Julia provides much better facilities for
811
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
10-
time Julia code running in global scope!)
11-
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+
[BenchmarkTools.jl](https://github.com/JuliaCI/BenchmarkTools.jl).
1413
"""
1514
module TickTock
1615

1716
export tick, tock, tok, peektimer, laptimer
1817

1918
if VERSION > v"0.7.0-"
20-
using Dates # for now() :(
19+
using Dates # for now()
2120
end
2221

2322
"""
2423
tick()
2524
26-
Start counting. The other functions are:
25+
Start a timer.
2726
28-
- `tock()` ` stop counting, show total elapsed time in canonical form
29-
- `tok()` ` stop counting, return seconds
30-
- `peektimer() ` continue counting, return elapsed seconds
31-
- `laptimer() ` continue counting, show total elapsed time in canonical form
27+
Other functions: `tock()` (stop counting and show canonical), `tok()` (stop
28+
counting and return seconds), `peektimer()` (continue counting, return elapsed
29+
seconds), and `laptimer()` (continue counting, show canonical)
3230
"""
3331
function tick()
3432
t0 = time_ns()
@@ -60,7 +58,7 @@ end
6058
"""
6159
peektimer()
6260
63-
Return the current elapsed seconds counted by the most recent timer, without stopping it.
61+
Return the elapsed seconds counted by the most recent timer, without stopping it.
6462
"""
6563
function peektimer()
6664
t1 = time_ns()
@@ -75,7 +73,7 @@ end
7573
"""
7674
tok()
7775
78-
Return the current elapsed seconds counted by the most recent timer, then stop counting.
76+
Return the elapsed seconds counted by the most recent timer, then stop counting.
7977
"""
8078
function tok()
8179
timers = get(task_local_storage(), :TIMERS, ())
@@ -112,8 +110,7 @@ end
112110
"""
113111
laptimer()
114112
115-
Print the current elapsed time, in canonical form, since the previous `tick()`,
116-
and continue counting.
113+
Print the elapsed time, in canonical form, of the most recent timer, and continue counting.
117114
"""
118115
laptimer() = showtimes(canonical=true)
119116

0 commit comments

Comments
 (0)