summaryrefslogtreecommitdiff
path: root/tests/High_Res_Timer_Test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/High_Res_Timer_Test.cpp')
-rw-r--r--tests/High_Res_Timer_Test.cpp47
1 files changed, 14 insertions, 33 deletions
diff --git a/tests/High_Res_Timer_Test.cpp b/tests/High_Res_Timer_Test.cpp
index 804d7da0ba4..b7899277249 100644
--- a/tests/High_Res_Timer_Test.cpp
+++ b/tests/High_Res_Timer_Test.cpp
@@ -20,7 +20,6 @@
#include "ace/Log_Msg.h"
#include "ace/High_Res_Timer.h"
#include "ace/Sched_Params.h"
-#include "ace/Get_Opt.h"
ACE_RCSID(tests, High_Res_Timer_Test, "$Id$")
@@ -71,10 +70,10 @@ time_interval (const ACE_Time_Value &interval)
static
u_int
-intervals [] = {0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000}; /* usec */
+intervals [] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000}; /* usec */
int
-main (int argc, ASYS_TCHAR *argv[])
+main (int, ASYS_TCHAR *[])
{
ACE_START_TEST (ASYS_TEXT ("High_Res_Timer_Test"));
@@ -84,39 +83,21 @@ main (int argc, ASYS_TCHAR *argv[])
u_int errors = 0;
- u_int iterations = 1;
-
- ACE_Get_Opt getopt (argc, argv, ASYS_TEXT ("i:"));
- for (int c; (c = getopt ()) != -1; )
- switch (c)
- {
- case 'i':
- iterations = ACE_OS::atoi (getopt.optarg);
- break;
- }
-
- // We don't check for errors if the interval is shorter than this
- // value because the OS has a finite resolution anyway.
- const u_int TIMER_RESOLUTION = 10000;
-
for (u_int i = 0; i < sizeof intervals / sizeof (u_int); ++i)
{
- for (u_int j = 0; j < iterations; ++j)
+ const ACE_Time_Value interval (0, intervals[i]);
+ const ACE_Time_Value measured = time_interval (interval);
+ ACE_DEBUG ((LM_DEBUG, "interval: %u usec, measured: %u usec%s\n",
+ interval.sec () * 1000000 + interval.usec (),
+ measured.sec () * 1000000 + measured.usec (),
+ intervals[i] <= 10000 ?
+ " (interval and measured may differ)" : ""));
+
+ if (intervals[i] > 10000)
{
- const ACE_Time_Value interval (0, intervals[i]);
- const ACE_Time_Value measured = time_interval (interval);
- ACE_DEBUG ((LM_DEBUG, "interval: %u usec, measured: %u usec%s\n",
- interval.sec () * 1000000 + interval.usec (),
- measured.sec () * 1000000 + measured.usec (),
- intervals[i] <= TIMER_RESOLUTION ?
- " (interval and measured may differ)" : ""));
-
- if (intervals[i] > TIMER_RESOLUTION)
- {
- errors += check (interval.sec () * 1000000 + interval.usec (),
- measured.sec () * 1000000 + measured.usec ());
- // Don't check for error for intervals below 10 msec.
- }
+ errors += check (interval.sec () * 1000000 + interval.usec (),
+ measured.sec () * 1000000 + measured.usec ());
+ // Don't check for error for intervals below 10 msec.
}
}