/* Organization: Technical University of Kosice (TUKE), Department: Department of Electronics and Multimedia Telecommunications (DEMT/KEMT), Faculties: Faculty of Electrical Engineering and Informatics (FEI), Feld of study: Informatics, Study program: Computer Networks, School year: 3., Bachelor study, 2020/2021, Author: Marek Rohac -- MR, Compiler: Winlibs GCC -- MinGW-W64 x86_64-posix-seh, built by Brecht Sanders, v. 10.2.0, -- also works with GCC 11.1.0 */ #include #include #define TIMER_INIT \ LARGE_INTEGER frequency; \ LARGE_INTEGER t1,t2; \ double elapsedTime; \ QueryPerformanceFrequency(&frequency); // Use to start the performance timer #define TIMER_START QueryPerformanceCounter(&t1); // Use to stop the timer #define TIMER_STOP \ QueryPerformanceCounter(&t2); \ elapsedTime=(double)(t2.QuadPart-t1.QuadPart)/frequency.QuadPart; int main(){ TIMER_INIT {TIMER_START Sleep(1000); TIMER_STOP} printf("Time of execution: %f sec\n", elapsedTime); return 0; }