Skip to content
Snippets Groups Projects
  • Cédric Roux's avatar
    28a08786
    T hacks: time_meas: add a periodic tracing mode · 28a08786
    Cédric Roux authored
    Useful to debug realtime issues, for example when calling a periodical
    routine, if it's not programmed carefully enough, it may be that the first
    call takes way longer than the next ones (for example it uses some memory
    that is not mapped in the process, leading to many page faults the first
    time it's executed).
    
    Having a periodic log for the timing of this routine with min/avg/max/count
    will reveal that a call is way longer than average and will help in
    finding where exactly in the code the time is spent, thanks to the ease
    of use of the T tracer; you put T(T_XX, T_INT(1)) just before the code
    you want to measure, you put T(T_XX, T_INT(0)) just after and time_meas
    will show the delta time between those events. Then you cut the routine
    in smaller pieces, measure with T(1)/T(0), and you finally reach the small
    guilty part that takes too long.
    28a08786
    History
    T hacks: time_meas: add a periodic tracing mode
    Cédric Roux authored
    Useful to debug realtime issues, for example when calling a periodical
    routine, if it's not programmed carefully enough, it may be that the first
    call takes way longer than the next ones (for example it uses some memory
    that is not mapped in the process, leading to many page faults the first
    time it's executed).
    
    Having a periodic log for the timing of this routine with min/avg/max/count
    will reveal that a call is way longer than average and will help in
    finding where exactly in the code the time is spent, thanks to the ease
    of use of the T tracer; you put T(T_XX, T_INT(1)) just before the code
    you want to measure, you put T(T_XX, T_INT(0)) just after and time_meas
    will show the delta time between those events. Then you cut the routine
    in smaller pieces, measure with T(1)/T(0), and you finally reach the small
    guilty part that takes too long.