@@ -76,79 +76,6 @@ gc_time_ns() = ccall(:jl_gc_total_hrtime, UInt64, ())
7676# total number of bytes allocated so far
7777gc_bytes () = ccall (:jl_gc_total_bytes , Int64, ())
7878
79- """
80- tic()
81-
82- Set a timer to be read by the next call to [`toc`](@ref) or [`toq`](@ref). The
83- macro call `@time expr` can also be used to time evaluation.
84-
85- ```julia-repl
86- julia> tic()
87- 0x0000c45bc7abac95
88-
89- julia> sleep(0.3)
90-
91- julia> toc()
92- elapsed time: 0.302745944 seconds
93- 0.302745944
94- ```
95- """
96- function tic ()
97- t0 = time_ns ()
98- task_local_storage (:TIMERS , (t0, get (task_local_storage (), :TIMERS , ())))
99- return t0
100- end
101-
102- """
103- toq()
104-
105- Return, but do not print, the time elapsed since the last [`tic`](@ref). The
106- macro calls `@timed expr` and `@elapsed expr` also return evaluation time.
107-
108- ```julia-repl
109- julia> tic()
110- 0x0000c46477a9675d
111-
112- julia> sleep(0.3)
113-
114- julia> toq()
115- 0.302251004
116- ```
117- """
118- function toq ()
119- t1 = time_ns ()
120- timers = get (task_local_storage (), :TIMERS , ())
121- if timers === ()
122- error (" toc() without tic()" )
123- end
124- t0 = timers[1 ]:: UInt64
125- task_local_storage (:TIMERS , timers[2 ])
126- (t1- t0)/ 1e9
127- end
128-
129- """
130- toc()
131-
132- Print and return the time elapsed since the last [`tic`](@ref). The macro call
133- `@time expr` can also be used to time evaluation.
134-
135- ```julia-repl
136- julia> tic()
137- 0x0000c45bc7abac95
138-
139- julia> sleep(0.3)
140-
141- julia> toc()
142- elapsed time: 0.302745944 seconds
143- 0.302745944
144- ```
145- """
146- function toc ()
147- t = toq ()
148- println (" elapsed time: " , t, " seconds" )
149- return t
150- end
151-
15279# print elapsed time, return expression value
15380const _mem_units = [" byte" , " KiB" , " MiB" , " GiB" , " TiB" , " PiB" ]
15481const _cnt_units = [" " , " k" , " M" , " G" , " T" , " P" ]
0 commit comments