delivery_man_sleep.cpp
Go to the documentation of this file.
00001 #include <hayai/hayai.hpp>
00002 
00003 #ifdef _WIN32
00004 #ifndef NOMINMAX
00005 #define NOMINMAX
00006 #endif
00007 #include <windows.h>
00008 
00009 inline void msleep(unsigned int duration)
00010 {
00011     Sleep(duration);
00012 }
00013 
00014 #else
00015 #include <unistd.h>
00016 
00017 inline void msleep(unsigned int duration)
00018 {
00019     usleep(duration * 1000);
00020 }
00021 #endif
00022 
00023 // The delivery man need some sleep sometimes.
00024 //
00025 // Sleep for 1 ms 10 times.
00026 BENCHMARK(SomeSleep, Sleep1ms, 5, 10)
00027 {
00028     msleep(1);
00029 }
00030 
00031 // The delivery man need some sleep sometimes.
00032 //
00033 // Sleep for 5 ms 10 times.
00034 BENCHMARK(SomeSleep, Sleep10ms, 5, 10)
00035 {
00036     msleep(10);
00037 }
00038 
00039 // The delivery man need some sleep sometimes.
00040 //
00041 // Sleep for 20 ms 10 times.
00042 BENCHMARK(SomeSleep, Sleep20ms, 5, 10)
00043 {
00044     msleep(20);
00045 }


hayai
Author(s): Nick Bruun
autogenerated on Thu Jun 6 2019 18:13:43