Code covered by the BSD License  

Highlights from
High Accuracy Timer for Windows

4.75

4.8 | 4 ratings Rate this file 18 Downloads (last 30 days) File Size: 1.87 KB File ID: #16534

High Accuracy Timer for Windows

by Ivo Houtzager

 

23 Sep 2007 (Updated 02 Apr 2011)

High-resolution performance counter

| Watch this File

File Information
Description

Uses the windows high-resolution performance counter to get the time which exceeds one microsecond accuracy.

time = hat;
% do some calculations
diff = hat - time;

MATLAB release MATLAB 6.5.1 (R13SP1)
Other requirements Windows, Visual Studio C++ with Windows SDK
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
16 Mar 2008 Haiwei Qiu

nice C program. Solved Matlab unaccurate timing problems.

17 Mar 2008 M Fridman

It appears that the timer call has significant overhead itself, so realize that by using it you may add to your execution time and skew some measurements.

09 Nov 2008 Quentin

I need help getting this code to work. I have Visual Basic 2008 Express Edition installed on my PC but I'm not sure how I initiate all of this with matlab.

Thanks for any help.

26 Jan 2009 Quentin  
02 Apr 2009 Holger Amort

I think the counter has to be calibrated, although the difference is usually very small.

05 Oct 2010 Maya

hey, this timer really helped me out, so, since inline syntax is kind of being done away with, could you provide another syntax for compiling the C file? tnx!

Please login to add a comment or rating.
Updates
02 Apr 2011

more thread safe

Tag Activity for this File
Tag Applied By Date/Time
clock Ivo Houtzager 22 Oct 2008 09:28:03
fun Ivo Houtzager 22 Oct 2008 09:28:03
mex Ivo Houtzager 22 Oct 2008 09:28:03
timer Ivo Houtzager 22 Oct 2008 09:28:03
high resolution Ivo Houtzager 22 Oct 2008 09:28:03
counter Ivo Houtzager 22 Oct 2008 09:28:04
utilities Ivo Houtzager 22 Oct 2008 09:28:04
accuracy Ivo Houtzager 22 Oct 2008 09:28:04
microsecond Ivo Houtzager 22 Oct 2008 09:28:04
timer David 07 Dec 2010 13:09:10
high resolution David 07 Dec 2010 13:09:16
clock David 07 Dec 2010 13:09:21
accuracy David 07 Dec 2010 13:09:22

Contact us at files@mathworks.com