Created
October 11, 2023 04:54
-
-
Save coderodde/c9ea63616b5744e341d843a79124cb0e to your computer and use it in GitHub Desktop.
The source file for the ThreadPreemptionCounter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
#define MAX(X, Y) (((X) < (Y)) ? (Y) : (X)) | |
int main() { | |
ULONGLONG ta = GetTickCount64(); | |
ULONGLONG maximumDuration = 0; | |
for (int i = 0; i < 10 * 1000 * 1000; i++) { | |
ULONGLONG tb = GetTickCount64(); | |
ULONGLONG duration = tb - ta; | |
maximumDuration = MAX(maximumDuration, duration); | |
} | |
printf("%llu\n", maximumDuration); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment