Code Monkey home page Code Monkey logo

timeroutputstracked's Introduction

TimerOutputsTracked

TimerOutputsTracked = TimerOutputs.jl + Cassette.jl to the end of timing all calls of "tracked" functions

Warning: I haven't assessed the overhead of the overdubbing mechanism yet, so expect timings, in particular of very fast functions, to be off!

Example

julia> using TimerOutputsTracked

julia> function A()
           return B() + C()
       end;

julia> B() = exp(rand(10,10));

julia> C() = zeros(10,10);

julia> TimerOutputsTracked.track([A, B, C, rand])

julia> @timetracked A();

julia> timings_tracked()
 ─────────────────────────────────────────────────────────────────────────
                                 Time                    Allocations      
                        ───────────────────────   ────────────────────────
    Tot / % measured:        1.93s /   0.1%            248KiB /   5.4%    

 Section        ncalls     time    %tot     avg     alloc    %tot      avg
 ─────────────────────────────────────────────────────────────────────────
 A                   1   2.32ms  100.0%  2.32ms   13.5KiB  100.0%  13.5KiB
   B                 1   2.28ms   98.3%  2.28ms   10.0KiB   73.9%  10.0KiB
     rand            1   42.0μs    1.8%  42.0μs   3.39KiB   25.1%  3.39KiB
       rand          1   35.0μs    1.5%  35.0μs   2.44KiB   18.0%  2.44KiB
         rand        1   22.6μs    1.0%  22.6μs   1.36KiB   10.1%  1.36KiB
   C                 1   5.58μs    0.2%  5.58μs      896B    6.5%     896B
 ─────────────────────────────────────────────────────────────────────────

Note that we didn't have to augment our source code (i.e. the definitions of A, B, C, or rand) with @timeit ... bits!

If you want the function argument types as well, you can set TimerOutputsTracked.show_argtypes() = true:

julia> TimerOutputsTracked.show_argtypes() = true

julia> @timetracked A();

julia> timings_tracked()
 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                      Time                    Allocations      
                                                                             ───────────────────────   ────────────────────────
                              Tot / % measured:                                   4.74s /  75.0%           1.33GiB / 100.0%    

 Section                                                             ncalls     time    %tot     avg     alloc    %tot      avg
 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 A ()                                                                     1    3.56s  100.0%   3.56s   1.33GiB  100.0%  1.33GiB
   B ()                                                                   1   42.1ms    1.2%  42.1ms    149KiB    0.0%   149KiB
     rand (Int64, Int64)                                                  1   27.5ms    0.8%  27.5ms   88.6KiB    0.0%  88.6KiB
       rand (DataType, Tuple{Int64, Int64})                               1   18.6ms    0.5%  18.6ms   58.7KiB    0.0%  58.7KiB
         rand (Random.TaskLocalRNG, DataType, Tuple{Int64, Int64})        1   9.09ms    0.3%  9.09ms   30.4KiB    0.0%  30.4KiB
   C ()                                                                   1    860μs    0.0%   860μs   1.80KiB    0.0%  1.80KiB
 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

timeroutputstracked's People

Contributors

carstenbauer avatar

Stargazers

Erin avatar Florian avatar Dongdong Kong avatar Alexander Demin avatar Maximilian Köhler avatar Dennis Ogiermann avatar Anshul Singhvi avatar Arjit Seth avatar Lasse Peters avatar  avatar Luiz M. Faria avatar ebigram avatar etpinard avatar Jeremiah avatar Kristoffer Carlsson avatar Michael Goerz avatar Páll Haraldsson avatar  avatar  avatar Peter avatar Simon Christ avatar Julius Krumbiegel avatar Jishnu Bhattacharya avatar

Watchers

 avatar  avatar

Forkers

t-bltg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.