Adds a hi-res timer for the current scope. Use hires timers as a low overhead timer for events that happen at a high frequency.
Hires timers for a scope will be shown below that scope as a percentage of the total scope time. Start and end times are not recorded for hires timers, instead the total time and call count are accumulated for the current scope.
For example, hires timer1 accounted for 60% of scope1 and was called 460 times. hires2 accounted for 10% of the time. The other 30% of time is spent in scope1.
Hires timers are useful when you have something that you want to measure which happens at a very high frequency, such as memory allocations, string operations or updates for lots of entities. Because these sort of events happen so many times during a frame, adding normal scopes would have too much overhead and make the thread graph hard to read. Hires timers have minimal overhead and are clear and easy to see in the thread graph.
Global Hires Timers
Global high resolution timers are used when you want to time scopes that happen many thousands of times a frame and don't want the overhead of recording a timespan for each scope. The scope simple adds to a global value which stores total duration and count, and then sends that value once a frame. The timer is reset at the start of each frame.
// this defines a global timer with name "my_timer" which will be shown in the
// "hires timers" graph in FramePro
FRAMEPRO_DECL_GLOBAL_HIRES_TIMER(my_timer, "hires timers")
graph: string literal - the name of the graph in which to display the timer
Declares a high resolution timer with the specified name.
Times the current scope and adds the value to the specified high-res timer. The high-res timer must have already been declared with FRAMEPRO_GLOBAL_HIRES_SCOPE.