diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | ace/Stats.cpp | 3 | ||||
-rw-r--r-- | tests/High_Res_Timer_Test.cpp | 14 |
3 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index f48b2127d82..21938feb3e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri Apr 8 16:39:00 2005 Gary Maxey <gary.maxey@hp.com> + + * ace/Stats.cpp + + In dump_throughput() handle cast to double when + ACE_LACKS_UNSIGNEDLONGLONG_T. + + * tests/High_Res_Timer_Test.cpp + + Use ACE_HRTIME_CONVERSION instead of ACE_U64_TO_U32 for + platform independence. + + Fri Apr 8 12:15:00 2005 Gary Maxey <gary.maxey@hp.com> * ace/Basic_Types.h diff --git a/ace/Stats.cpp b/ace/Stats.cpp index b49f108fa27..47c4da1dae4 100644 --- a/ace/Stats.cpp +++ b/ace/Stats.cpp @@ -591,6 +591,9 @@ ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg, double seconds = # if defined ACE_LACKS_LONGLONG_T elapsed_time / sf; +#elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER ( + ACE_U_LongLong(elapsed_time / sf))); # else /* ! ACE_LACKS_LONGLONG_T */ static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf)); # endif /* ! ACE_LACKS_LONGLONG_T */ diff --git a/tests/High_Res_Timer_Test.cpp b/tests/High_Res_Timer_Test.cpp index 7a990302fd8..5398157d8d3 100644 --- a/tests/High_Res_Timer_Test.cpp +++ b/tests/High_Res_Timer_Test.cpp @@ -58,11 +58,11 @@ check_micro_nano (ACE_hrtime_t microinterval, ACE_hrtime_t nanointerval) ACE_hrtime_t hr_difference = (microinterval > nanointerval ? microinterval - nanointerval : nanointerval - microinterval ); - const u_int difference = ACE_U64_TO_U32 (hr_difference); + const u_int difference = ACE_HRTIME_CONVERSION (hr_difference); if (nanointerval == 0) nanointerval = 1; // Prevent divide-by-zero const u_int promille_difference = difference * 1000 / - ACE_U64_TO_U32(nanointerval); + ACE_HRTIME_CONVERSION(nanointerval); if ((promille_difference < threshold) || (difference < 1500)) return 0; @@ -70,8 +70,8 @@ check_micro_nano (ACE_hrtime_t microinterval, ACE_hrtime_t nanointerval) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("The microseconds * 1000 of %u differs from ") ACE_TEXT ("the nanoseconds of %u by %u promille\n"), - ACE_U64_TO_U32 (microinterval), - ACE_U64_TO_U32 (nanointerval), + ACE_HRTIME_CONVERSION (microinterval), + ACE_HRTIME_CONVERSION (nanointerval), promille_difference), 1); } @@ -156,15 +156,15 @@ run_main (int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Time_Value usec: %u, ACE_HR nsec: %u\n"), measured.sec () * 1000000 + measured.usec (), - ACE_U64_TO_U32 (nanoseconds))); + ACE_HRTIME_CONVERSION (nanoseconds))); // This gives problems -> should be fixed errors += check_micro_nano (measured.sec () * 1000000 + measured.usec (), nanoseconds); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_High_Res_Timer usec: %u, nsec: %u\n"), - ACE_U64_TO_U32 (microseconds), - ACE_U64_TO_U32 (nanoseconds))); + ACE_HRTIME_CONVERSION (microseconds), + ACE_HRTIME_CONVERSION (nanoseconds))); // Now check the ACE_High_Res_Timer-calculated values against // each other. errors += check_micro_nano (microseconds, nanoseconds); |