-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement of @timeit_all #156
Comments
Interesting. If you look at what a macro gets to work with:
you can see there are |
Thanks for your quick response and useful information |
Sorry. I still has no idea how to implement this function. |
This is my solution: https://github.com/jl-spatial/Ipaper.jl/blob/master/src/timeit_all.jl julia> @timeit_all function foo(n)
for i = 1:n
begin
A = randn(100, 100, 20)
m = maximum(A)
end
if i < 10
Am = mapslices(sum, A; dims=2)
B = A[:, :, 5]
Bsort = mapslices(B; dims=1) do col
sort(col)
end
elseif i < 15
sleep(0.01)
else
sleep(0.02)
end
let j
j = i
while j < 5
b = rand(100)
C = B .* b
j += 1
end
end
end
sleep(0.5)
end
foo (generic function with 1 method)
julia> foo(20)
julia> show(to, sortby = :firstexec)
───────────────────────────────────────────────────────────────────────────────────────────────────
Time Allocations
─────────────────────── ────────────────────────
Tot / % measured: 11.8s / 13.8% 272MiB / 43.4%
Section ncalls time %tot avg alloc %tot avg
───────────────────────────────────────────────────────────────────────────────────────────────────
L5: for 1 1.12s 69.0% 1.12s 118MiB 100.0% 118MiB
L6: block 20 149ms 9.1% 7.43ms 30.5MiB 25.8% 1.53MiB
L7: A = randn(100, 100, 20) 20 140ms 8.6% 6.99ms 30.5MiB 25.8% 1.53MiB
L8: m = maximum(A) 20 2.22ms 0.1% 111μs 640B 0.0% 32.0B
L10: if 20 974ms 59.8% 48.7ms 86.9MiB 73.5% 4.34MiB
L11: Am = mapslices(sum, A; di ... 9 435ms 26.7% 48.3ms 61.8MiB 52.3% 6.87MiB
L12: B = A[:, :, 5] 9 431μs 0.0% 47.8μs 704KiB 0.6% 78.2KiB
L13: Bsort = mapslices(B; dims ... 9 278ms 17.1% 30.9ms 24.3MiB 20.6% 2.70MiB
L21: let 20 506μs 0.0% 25.3μs 797KiB 0.7% 39.8KiB
L22: j = i 20 18.8μs 0.0% 940ns 640B 0.0% 32.0B
L23: while 20 411μs 0.0% 20.5μs 794KiB 0.7% 39.7KiB
L24: b = rand(100) 10 10.9μs 0.0% 1.09μs 9.06KiB 0.0% 928B
L25: C = B .* b 10 335μs 0.0% 33.5μs 782KiB 0.6% 78.2KiB
L26: j += 1 10 6.70μs 0.0% 670ns 320B 0.0% 32.0B
L30: sleep(0.5) 1 505ms 31.0% 505ms 176B 0.0% 176B
─────────────────────────────────────────────────────────────────────────────────────────────────── |
Any idea how to implement the macro reported by @ffevotte
https://discourse.julialang.org/t/tooling-for-line-by-line-memory-allocation-analysis/74552/6
The text was updated successfully, but these errors were encountered: