Skip to content

DANIEC7909/cpp-scope-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

cpp-scope-timer

A lightweight, header-only C++ timer for measuring code execution time using RAII.

Quick Example

{
    Timer<Timer_Aliases::ms> timer("Some Operation");
    // your code here
} // automatically prints: [Some Operation] Took: 42ms

Manual Timer

{
ManualTimer<Timer_Aliases::ms> manualTimer ("Manual Timer");
while(true)
{
    manualTimer.StartTimer();
    // your code here
    manualTimer.StopTimer();
} // automatically prints: [Manual Timer] Took: 42ms

Passing custom function for logging

{
    void CustomLog(const char* name, int64_t amount,const char* type)
    {
        // your code here
    }
    void foo()
    {
      Timer<Timer_Aliases::ms> timer("Some Operation",CustomLog);
        // your code here
    } 
}

About

A lightweight, header-only C++ timer for measuring code execution time using RAII.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages