Skip to content

MisterRabbit0w0/Timestamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timestamp

A high-precision interval timing tool that measures and analyzes timing accuracy over 100 iterations.

  • Dual timer: Timer (ms, system_clock) for intervals >= 1ms, HighResTimer (us, steady_clock) for sub-millisecond intervals, automatically selected based on input
  • Statistical analysis: Computes percentile statistics (p50, p75, p90, p95, p99)
  • Logging: Automatic logging to timestamped .log files in the logs/ directory, raw interval data written to log file only
  • Cross-platform: Supports Windows, Linux, and macOS; Windows builds use timeBeginPeriod and thread priority elevation for improved precision

Build

Using CMake (Recommended)

git clone https://github.com/MisterRabbit0w0/Timestamp && cd Timestamp
cmake -S . -B build
cmake --build build --config Release

Using g++ (Linux/macOS)

git clone https://github.com/MisterRabbit0w0/Timestamp && cd Timestamp
g++ -std=c++17 -O2 -I./include \
    src/main.cpp src/base_timer.cpp src/timer.cpp src/high_res_timer.cpp \
    src/utils.cpp src/logger.cpp \
    -o timer -lpthread

Usage

./timer <seconds>

Examples

./timer 1.0      # 1s interval, uses Timer (ms)
./timer 0.01     # 10ms interval, uses Timer (ms)
./timer 0.0005   # 500us interval, uses HighResTimer (us)
./timer 0.0001   # 100us interval, uses HighResTimer (us)

Example Output

Start Timestamp (ms): 1707280123456
Timestamp (ms): 1707280124456	(real interval: 1000.12 ms)
Timestamp (ms): 1707280125456	(real interval: 999.98 ms)
...

========== Timing Statistics ==========
Intervals average (ms): 1000.05
Intervals 50th Percentile (ms): 1000.02
Intervals 75th Percentile (ms): 1000.08
Intervals 90th Percentile (ms): 1000.15
Intervals 95th Percentile (ms): 1000.25
Intervals 99th Percentile (ms): 1000.45
========================================

Requirements

  • C++17 compatible compiler
  • CMake 3.10+ (for CMake build)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors