summaryrefslogtreecommitdiff
path: root/performance-tests
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-19 16:27:57 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-19 16:27:57 +0000
commitc80cd240886dd3045682862b852c1a20b323a4fb (patch)
treeaae9eae312fec079b19dfc823f4dcb2692099b0c /performance-tests
parent04fb56963628f9885be5f7a664da823079959525 (diff)
downloadATCD-c80cd240886dd3045682862b852c1a20b323a4fb.tar.gz
fixed 64-to-32 bit casts to work with unsigned 64 bit ACE_hrtime_t on NT
Diffstat (limited to 'performance-tests')
-rw-r--r--performance-tests/Misc/context_switch_time.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/performance-tests/Misc/context_switch_time.cpp b/performance-tests/Misc/context_switch_time.cpp
index 48b184c9eb6..6334cb54f46 100644
--- a/performance-tests/Misc/context_switch_time.cpp
+++ b/performance-tests/Misc/context_switch_time.cpp
@@ -856,13 +856,8 @@ High_Priority_Synchronized_Task::svc ()
ACE_hrtime_t nsec;
timer_.elapsed_time (nsec);
- // Convert the elapsed time from 64 to 32 bits.
- const ACE_UINT32 delta_t =
- ACE_static_cast (ACE_UINT32,
- nsec / ACE_static_cast (ACE_UINT32, 1u));
-
const ACE_UINT32 context_switch_time =
- delta_t - mutex_acquire_release_time;
+ ACE_U64_TO_U32 (nsec) - mutex_acquire_release_time;
total_time_ += context_switch_time;
@@ -1218,28 +1213,31 @@ main (int argc, char *argv [])
suspend_resume_test.elapsed_time ())
{
context_switch_test_stats.
- sample ((ping_suspend_resume_test.elapsed_time () -
- suspend_resume_test.elapsed_time ()) /
- ACE_static_cast (ACE_UINT32, 1u));
+ sample (ACE_U64_TO_U32 (
+ 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 () /
- num_iterations),
- (double) (suspend_resume_test.elapsed_time () /
- num_iterations),
- (double) ((ping_suspend_resume_test.elapsed_time () -
- suspend_resume_test.elapsed_time ()) /
- num_iterations / 2u)));
+ (double) (ACE_UINT64_DBLCAST_ADAPTER (
+ ping_suspend_resume_test.elapsed_time ()) /
+ num_iterations),
+ (double) (ACE_UINT64_DBLCAST_ADAPTER (
+ suspend_resume_test.elapsed_time ()) /
+ num_iterations),
+ (double) (ACE_UINT64_DBLCAST_ADAPTER (
+ ping_suspend_resume_test.elapsed_time () -
+ suspend_resume_test.elapsed_time ()) /
+ num_iterations / 2u)));
}
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 () /
- num_iterations),
- (double) (suspend_resume_test.elapsed_time () /
- num_iterations)));
+ ACE_DEBUG ((LM_INFO, "ping suspend/resume time of %u usec was "
+ "less than suspend/resume time of %u\n",
+ ping_suspend_resume_test.elapsed_time () /
+ num_iterations,
+ suspend_resume_test.elapsed_time () /
+ num_iterations));
}
}
@@ -1248,8 +1246,7 @@ main (int argc, char *argv [])
// Wait for all tasks to exit.
ACE_Thread_Manager::instance ()->wait ();
- yield_test_stats.sample (yield_test.elapsed_time () /
- ACE_static_cast (ACE_UINT32, 1u));
+ yield_test_stats.sample (ACE_U64_TO_U32 (yield_test.elapsed_time ()));
// Try _really_ hard not to use floating point.
ACE_DEBUG ((LM_INFO, "context switch time from yield test is %u.%03u "