summaryrefslogtreecommitdiff
path: root/performance-tests
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-02-09 00:47:03 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-02-09 00:47:03 +0000
commit44c1c5083f6821c1120be6dcdd0d5aa62443e4ca (patch)
tree9f53e02a8631f6a0665c49ee0f9ba7bcb097103d /performance-tests
parent3419635d86c26dc3df7cd0d8db9850ee8fc275c3 (diff)
downloadATCD-44c1c5083f6821c1120be6dcdd0d5aa62443e4ca.tar.gz
divide ACE_hrtime_t by ACE_UINT32, to prevent ambiguity with ACE_U_LongLong operator / overloading
Diffstat (limited to 'performance-tests')
-rw-r--r--performance-tests/Misc/basic_perf.cpp61
-rw-r--r--performance-tests/Misc/context_switch_time.cpp22
-rw-r--r--performance-tests/Misc/preempt.cpp3
3 files changed, 47 insertions, 39 deletions
diff --git a/performance-tests/Misc/basic_perf.cpp b/performance-tests/Misc/basic_perf.cpp
index 3065c991a3e..c789be3ce46 100644
--- a/performance-tests/Misc/basic_perf.cpp
+++ b/performance-tests/Misc/basic_perf.cpp
@@ -52,9 +52,9 @@ inline
double
per_iteration (const ACE_hrtime_t elapsed /* nanoseconds */)
{
- // The division by 1 allows transparent support of ACE_U_LongLong;
- // its operator/ produces a u_long result.
- double ms_per_iteration = (double) (elapsed/1) / 1000.0 /
+ // The division by (ACE_UINT32) 1u allows transparent support of
+ // ACE_U_LongLong; its operator/ produces a u_long result.
+ double ms_per_iteration = (double) (elapsed/ (ACE_UINT32) 1u) / 1000.0 /
(double) iterations;
// Don't print out "-0.000" or "-0.001" . . .
@@ -495,33 +495,34 @@ get_options (int argc, char *argv [])
while ((opt = get_opt ()) != EOF)
{
- switch (opt)
- {
- case 'i':
- {
- int temp = ACE_OS::atoi (get_opt.optarg);
- if (temp > 0)
- iterations = (u_int) temp;
- else
- {
- ACE_DEBUG ((LM_ERROR, "%s: number of iterations must be > 0\n",
- argv [0]));
- return 1;
- }
- break;
- }
- case '?':
- ACE_DEBUG ((LM_INFO, "usage: %s %s\n", argv [0], usage));
- ACE_OS::exit (0);
- break;
- default:
- ACE_DEBUG ((LM_ERROR, "%s: unknown arg, %c\n", argv [0], (char) opt));
- ACE_DEBUG ((LM_ERROR, "usage: %s %s\n", argv [0], usage));
- return 1;
- }
+ switch (opt)
+ {
+ case 'i':
+ {
+ int temp = ACE_OS::atoi (get_opt.optarg);
+ if (temp > 0)
+ iterations = (u_int) temp;
+ else
+ {
+ ACE_DEBUG ((LM_ERROR, "%s: number of iterations must be > 0\n",
+ argv [0]));
+ return 1;
+ }
+ break;
+ }
+ case '?':
+ ACE_DEBUG ((LM_INFO, "usage: %s %s\n", argv [0], usage));
+ ACE_OS::exit (0);
+ break;
+ default:
+ ACE_DEBUG ((LM_ERROR, "%s: unknown arg, %c\n", argv [0],
+ (char) opt));
+ ACE_DEBUG ((LM_ERROR, "usage: %s %s\n", argv [0], usage));
+ return 1;
+ }
}
- switch (argc - get_opt.optind)
+ switch (argc - get_opt.optind)
{
case 0:
// OK
@@ -545,14 +546,14 @@ get_options (int argc, char *argv [])
int
main (int argc, char *argv[])
{
- if (get_options (argc, argv))
+ if (get_options (argc, argv))
ACE_OS::exit (-1);
struct utsname name;
if (ACE_OS::uname (&name) != -1)
ACE_DEBUG ((LM_INFO, "%s (%s), %s %s at %T\n",
- name.nodename, name.machine, name.sysname, name.release));
+ name.nodename, name.machine, name.sysname, name.release));
ACE_DEBUG ((LM_INFO, "%u iterations\n", iterations));
diff --git a/performance-tests/Misc/context_switch_time.cpp b/performance-tests/Misc/context_switch_time.cpp
index 68b40f0efce..01e356d99e4 100644
--- a/performance-tests/Misc/context_switch_time.cpp
+++ b/performance-tests/Misc/context_switch_time.cpp
@@ -695,29 +695,34 @@ main (int argc, char *argv [])
// Wait for all tasks to exit.
ACE_Thread_Manager::instance ()->wait ();
- // NOTE: the divisions by 1ul below allow transparent support of
- // ACE_U_LongLongs.
+ // NOTE: the divisions by (ACE_UINT32) 1u below allow transparent
+ // support of ACE_U_LongLongs.
if (ping_suspend_resume_test.elapsed_time () >
suspend_resume_test.elapsed_time ())
{
ACE_DEBUG ((LM_INFO, "context switch time is (%.3f - %.3f)/2 = "
"%.3f microseconds\n",
- (double) (ping_suspend_resume_test.elapsed_time ()/1ul) /
+ (double) (ping_suspend_resume_test.elapsed_time ()/
+ (ACE_UINT32) 1u) /
num_iterations,
- (double) (suspend_resume_test.elapsed_time ()/1ul) /
+ (double) (suspend_resume_test.elapsed_time ()/
+ (ACE_UINT32) 1u) /
num_iterations,
(double) ((ping_suspend_resume_test.elapsed_time () -
- suspend_resume_test.elapsed_time ())/1ul) /
+ suspend_resume_test.elapsed_time ())/
+ (ACE_UINT32) 1u) /
num_iterations / 2));
}
else
{
ACE_DEBUG ((LM_INFO, "ping suspend/resume time of %.3f usec was "
"less than suspend/resume time of %.3f\n",
- (double) (ping_suspend_resume_test.elapsed_time ()/1ul) /
+ (double) (ping_suspend_resume_test.elapsed_time ()/
+ (ACE_UINT32) 1u) /
num_iterations,
- (double) (suspend_resume_test.elapsed_time ()/1ul) /
+ (double) (suspend_resume_test.elapsed_time ()/
+ (ACE_UINT32) 1u) /
num_iterations));
}
@@ -728,7 +733,8 @@ main (int argc, char *argv [])
ACE_DEBUG ((LM_INFO, "context switch time from yield test is %.3f "
"microseconds\n",
- (double) (yield_test.elapsed_time ()/1ul) / num_iterations /
+ (double) (yield_test.elapsed_time ()/ (ACE_UINT32) 1u) /
+ num_iterations /
2));
}
diff --git a/performance-tests/Misc/preempt.cpp b/performance-tests/Misc/preempt.cpp
index e01c8269239..ff4386a4e02 100644
--- a/performance-tests/Misc/preempt.cpp
+++ b/performance-tests/Misc/preempt.cpp
@@ -127,7 +127,8 @@ High_Priority_Task::svc (void)
for (u_int i = 0; i < iterations; ++i)
{
- time_ [i] = (u_long) ((ACE_OS::gethrtime () - starttime)/1000000ul);
+ time_ [i] = (u_long) ((ACE_OS::gethrtime () - starttime)/
+ (ACE_UINT32) 1000000u);
ACE_OS::select (0, 0, 0, 0, &pause);
}