https://github.com/sukibaby/profiling_timer
https://github.com/sukibaby/profiling_timer
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sukibaby/profiling_timer
- Owner: sukibaby
- License: mit
- Created: 2024-08-05T06:49:04.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-05T07:03:30.000Z (10 months ago)
- Last Synced: 2024-12-28T20:46:35.917Z (5 months ago)
- Language: C
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is my timer class designed for profiling single-threaded applications with high resolution timestamps.
I've provided ready-to-use classes for both C and C++.
Here is an example of how you might use the `ProTi` (PROfiling TImer) class in your C++ project. The idea is you can set a bunch of timestamps, figure out how many you have (or what the index of each one is), figure out what timer is being used by the system, etc.
```
ProTi profiler;// Set a bunch of timestamps and figure out what each of their indexes are
profiler.Start();
profiler.GetTimestampCount();
profiler.Start();
profiler.GetTimestampCount();
profiler.Start();
profiler.GetTimestampCount();( ... code to be profiled ... )
// Stop the first timer and get the elapsed time
std::uint64_t elapsedTime = profiler.Stop(0);// Print the elapsed time in nanoseconds
std::cout << "Elapsed time: " << elapsedTime << " nanoseconds" << std::endl;// Print the mode used for timing
std::cout << "Timing mode: " << profiler.ReturnMode() << std::endl;
```