Thanks for the tip. Maybe I could add a custom print version with verbosity options. I don't want the default output to be too cluttered.
On Wednesday, April 6, 2016 at 4:07:22 AM UTC+2, Jeffrey Sarnoff wrote: > > You might have an option to show "wall time / call" > or just include it in the table however you like the columns. > > section | avg time | number | time used | time used > | per call | of calls | all calls | % of total > > ----------|-----------|------------|--------------|---------------- > in a loop | 101.156 | 5 | 505.779ms | 16 > > > On Tuesday, April 5, 2016 at 9:39:38 PM UTC-4, Jeffrey Sarnoff wrote: >> >> This is very useful and much appreciated. Thank you. >> >> On Tuesday, April 5, 2016 at 3:42:45 PM UTC-4, Kristoffer Carlsson wrote: >>> >>> Hello everyone, >>> >>> I put up a new (unregistered) small package for timing different >>> sections of code. It works similar to @time in Base but you also give the >>> code section being timed a label. We can then track the total time and >>> number of calls that are made to code sections with that label and pretty >>> print it in the end. This feature existed in a C++ library I used to use >>> (deal.II) and I missed it in Julia. >>> >>> Here is a small example. >>> >>> using TimerOutputs >>> >>> const time_tracker = TimerOutput(); >>> >>> @timeit time_tracker "sleeping" sleep(1) >>> >>> @timeit time_tracker "loop" for i in 1:10 >>> rand() >>> sleep(0.1) >>> end >>> >>> v = 0.0 >>> for i in 1:5 >>> v += @timeit time_tracker "in a loop" begin >>> sleep(0.1) >>> rand() >>> end >>> end >>> >>> print(time_tracker) >>> +---------------------------------------------+------------+------------+ >>> | Total wallclock time elapsed since start | 3.155 s | | >>> | | | | >>> | Section | no. calls | wall time | % of total | >>> +---------------------------------------------+------------+------------+ >>> | loop | 1 | 1.012 s | 32 % | >>> | sleeping | 1 | 1.002 s | 32 % | >>> | in a loop | 5 | 505.779 ms | 16 % | >>> +---------------------------------------------+------------+------------+ >>> >>> Feel free to comment on the package name, macro name, format of the >>> output etc. >>> >>> The URL is: https://github.com/KristofferC/TimerOutputs.jl >>> >>> Best regards, Kristoffer >>> >>
