https://github.com/mp3guy/stopwatch
Easy to use simple benchmarking tool
https://github.com/mp3guy/stopwatch
Last synced: 8 months ago
JSON representation
Easy to use simple benchmarking tool
- Host: GitHub
- URL: https://github.com/mp3guy/stopwatch
- Owner: mp3guy
- License: mit
- Created: 2014-03-07T15:12:16.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-11-13T18:44:44.000Z (over 1 year ago)
- Last Synced: 2025-03-21T22:21:52.596Z (about 1 year ago)
- Language: C++
- Size: 86.9 KB
- Stars: 31
- Watchers: 3
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Stopwatch
=========
Easy to use simple benchmarking tool.
Sends UDP packets to localhost, which StopwatchViewer receives and displays stats on, including plots (credit to [Fiachra Matthews](http://www.linkedin.com/pub/fiachra-matthews/17/48b/a12) here).
StopwatchViewer needs Qt6 to build. Simply include Stopwatch.h in whatever code you want to benchmark and use as such;
```cpp
#include
#include
#include "Stopwatch.h"
int main(int argc, char *argv[])
{
//This stops duplicate timings on multiple runs
Stopwatch::getInstance().setCustomSignature(32434);
STOPWATCH("Timing1",
if(argc >= 1)
{
sleep(1);
}
);
TICK("Timing2");
while(argc > 0)
{
sleep(2);
argc--;
}
TOCK("Timing2");
Stopwatch::getInstance().sendAll();
}
```
Then just watch the stats in StopwatchViewer GUI. Pass in the "-c" flag to use the CLI instead of Qt GUI.
Uses some code from the B-Human code release (http://www.b-human.de/).
Install
=======
```
git clone https://github.com/mp3guy/Stopwatch.git
cd Stopwatch
git submodule init && git submodule update
cd third-party/cpp-terminal
mkdir build && cd build
cmake .. && make -j
cd ../../..
mkdir build && cd build
cmake .. && make -j
```
Running Stopwatch in terminal mode without GUI
===============================================
```
./Stopwatch -c
```
With key bindings:
- k or up arrow: scroll up
- j or down arrow: scroll down
- c: flush the cache
- q or Esc or Ctrl+c: quit