diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-03-05 17:14:45 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-03-05 17:14:45 +0000 |
commit | 58033491c6d0bac82315c1fdb1ec9b39be58093f (patch) | |
tree | c69c3aa67ec66758066e959bd0d533ea336ec236 /tests/Memcpy_Test.cpp | |
parent | 2efc882384a34f61311a24fc641d1b5fd5776356 (diff) | |
download | ATCD-TAO-1_5.tar.gz |
This commit was manufactured by cvs2svn to create tag 'TAO-1_5'.TAO-1_5
Diffstat (limited to 'tests/Memcpy_Test.cpp')
-rw-r--r-- | tests/Memcpy_Test.cpp | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/tests/Memcpy_Test.cpp b/tests/Memcpy_Test.cpp deleted file mode 100644 index bcf1342a748..00000000000 --- a/tests/Memcpy_Test.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//$Id$ - -#include "ace/OS_NS_string.h" -#include "ace/High_Res_Timer.h" - -#include "test_config.h" - -void* -smemcpy( void* dest, const void* src, const size_t n) -{ - unsigned char* to = static_cast<unsigned char*>( dest) ; - const unsigned char* from = static_cast<const unsigned char*>( src) ; - // Unroll the loop... - switch( n) { - case 16: to[ 15] = from[ 15] ; - case 15: to[ 14] = from[ 14] ; - case 14: to[ 13] = from[ 13] ; - case 13: to[ 12] = from[ 12] ; - case 12: to[ 11] = from[ 11] ; - case 11: to[ 10] = from[ 10] ; - case 10: to[ 9] = from[ 9] ; - case 9: to[ 8] = from[ 8] ; - case 8: to[ 7] = from[ 7] ; - case 7: to[ 6] = from[ 6] ; - case 6: to[ 5] = from[ 5] ; - case 5: to[ 4] = from[ 4] ; - case 4: to[ 3] = from[ 3] ; - case 3: to[ 2] = from[ 2] ; - case 2: to[ 1] = from[ 1] ; - case 1: to[ 0] = from[ 0] ; - case 0: return dest ; - default: return ACE_OS::memcpy( dest, src, n) ; - } -} - -void -testit( int type) -{ - char buffer[16] ; - size_t size = 16 ; - - switch( type) { - case 0: smemcpy( (void*)buffer, (void*)" THIS IS A TEST", size) ; break ; - case 1: ACE_OS::memcpy( (void*)buffer, (void*)" THIS IS A TEST", size) ; break ; - } - -} - -namespace { enum { ITERATIONS = 100000000 } ; } - -int -run_main (int, ACE_TCHAR *[]) -{ - ACE_START_TEST (ACE_TEXT ("Memcpy_Test")); - - //ACE_Time_Value start, now ; - struct timeval start, now; - - for (int i = ITERATIONS ; i > 0 ; --i) { - testit(0) ; - } - - start = ACE_High_Res_Timer::gettimeofday_hr (); - for (int j = ITERATIONS ; j > 0 ; --j) { - testit(0) ; - } - - now = ACE_High_Res_Timer::gettimeofday_hr () ; - - double fast = 1000000 * (now.tv_sec - start.tv_sec) + - now.tv_usec - start.tv_usec ; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%f uSec per iteration for fast version.\n"), - fast / ITERATIONS - )) ; - - start = ACE_High_Res_Timer::gettimeofday_hr () ; - for (int k = ITERATIONS ; k > 0 ; --k) { - testit(1) ; - } - now = ACE_High_Res_Timer::gettimeofday_hr () ; - - double slow = 1000000 * (now.tv_sec-start.tv_sec) + now.tv_usec - start.tv_usec ; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%f uSec per iteration for slow version.\n"), - slow / ITERATIONS - )) ; - - ACE_END_TEST; - - return 0 ; -} |