High Accuracy Timer

High-resolution performance counter
Updated 11 Jul 2015

View License

Uses the high-resolution performance counter to get the time which exceeds one microsecond accuracy.
time = hat;
% do some calculations
diff = hat - time;

Cite As

Ivo Houtzager (2024). High Accuracy Timer (https://www.mathworks.com/matlabcentral/fileexchange/16534-high-accuracy-timer), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Clocks and Timers in Help Center and MATLAB Answers

Inspired: Simulink Block for Real Time Execution

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Version Published Release Notes

more thread safe
Added Linux support using the POSIX high-resolution performance counter