X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2Ftest%2Ftimer%2Fiotest.c;h=17a91ecff13017a4967057330e57b421f8586c61;hp=02b8c4bcbce4b4ad80d199f6c8464c229e824b3d;hb=f83bd22fe2dcb3ca0ddb9321944ee0b9c9b61ea6;hpb=81de96b92467866823681e24901f7eeaf119e955 diff --git a/src/test/timer/iotest.c b/src/test/timer/iotest.c index 02b8c4b..17a91ec 100644 --- a/src/test/timer/iotest.c +++ b/src/test/timer/iotest.c @@ -26,7 +26,7 @@ static IOHANDLER_LOG_BACKEND(io_log); static struct timeval test_clock1, test_clock2; static int timercount; -static void add_timer(int ms) { +void add_timer(int ms) { struct timeval timeout; gettimeofday(&timeout, NULL); timeout.tv_usec += (ms % 1000) * 1000; @@ -41,9 +41,12 @@ static void add_timer(int ms) { int main(int argc, char *argv[]) { iolog_backend = io_log; + iohandler_set(IOHANDLER_SETTING_HIGH_PRECISION_TIMER, 1); + gettimeofday(&test_clock1, NULL); gettimeofday(&test_clock2, NULL); - add_timer(TEST_DURATION); + //add_timer(TEST_DURATION); + iohandler_constant_timer(TEST_DURATION, io_callback); timercount = 0; printf("[timer 0] %ld.%ld\n", test_clock1.tv_sec, test_clock1.tv_usec); @@ -59,7 +62,7 @@ static IOHANDLER_CALLBACK(io_callback) { double diff2; switch(event->type) { case IOEVENT_TIMEOUT: - add_timer(TEST_DURATION); + //add_timer(TEST_DURATION); timercount++; gettimeofday(&curr_time, NULL); diff1 = (curr_time.tv_sec - test_clock1.tv_sec) * 1000 + ((curr_time.tv_usec - test_clock1.tv_usec) / 1000);