diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-06-27 18:11:07 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-06-27 18:11:07 +0000 |
commit | 8ba0e6c10aa453f09fc4fe3e1c3cef3df1c179d9 (patch) | |
tree | 4d2d5d539a8ae76cac41bbae6bdcd8939adf08cb /examples | |
parent | 5f4da186c8e1fc3ce63d7e7e7630812d2665b77f (diff) | |
download | ATCD-8ba0e6c10aa453f09fc4fe3e1c3cef3df1c179d9.tar.gz |
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Mem_Map/IO-tests/IO_Test.cpp | 10 | ||||
-rw-r--r-- | examples/Mem_Map/IO-tests/test_io.cpp | 46 |
2 files changed, 33 insertions, 23 deletions
diff --git a/examples/Mem_Map/IO-tests/IO_Test.cpp b/examples/Mem_Map/IO-tests/IO_Test.cpp index 267da14428a..12dde886e25 100644 --- a/examples/Mem_Map/IO-tests/IO_Test.cpp +++ b/examples/Mem_Map/IO-tests/IO_Test.cpp @@ -131,9 +131,9 @@ int Mmap1_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp) { ACE_Mem_Map map_input (fileno (input_fp)); - void *src = 0; + void *src = map_input.addr (); - if (map_input (src) == -1) + if (src == MAP_FAILED) ACE_ERROR_RETURN ((LM_ERROR, "%s", this->name ()), -1); else { @@ -166,10 +166,10 @@ Mmap2_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp) ACE_Mem_Map map_input (fileno (input_fp)); int size = map_input.size (); ACE_Mem_Map map_output (fileno (output_fp), size, PROT_WRITE, MAP_SHARED); - void *src = 0; - void *dst = 0; + void *src = map_input.addr (); + void *dst = map_output.addr (); - if (map_input (src) == -1 || map_output (dst) == -1) + if (src == MAP_FAILED || dst == MAP_FAILED) return -1; else { diff --git a/examples/Mem_Map/IO-tests/test_io.cpp b/examples/Mem_Map/IO-tests/test_io.cpp index e9ba03fb394..3a044d52643 100644 --- a/examples/Mem_Map/IO-tests/test_io.cpp +++ b/examples/Mem_Map/IO-tests/test_io.cpp @@ -24,7 +24,7 @@ static int remove_output = 1; static int iteration_count = 100; // Profiler used to keep track of file I/O time. -static ACE_Profile_Timer tm; +static ACE_Profile_Timer profile_timer; // Explain usage and exit. @@ -80,44 +80,53 @@ parse_args (int argc, char *argv[]) static IO_Test *test_vector[100]; -static void +static int run_tests (int iterations, FILE *input_fp, FILE *output_fp) { // If HP/UX didn't suck so badly we could initialize in the global // scope... int i = 0; - ACE_NEW (test_vector[i++], Stdio_Test ("Stdio_Test", tm)); - ACE_NEW (test_vector[i++], Block_Fread_Fwrite_Test ("Block_Fread_Fwrite_Test", tm)); - ACE_NEW (test_vector[i++], Block_Read_Write_Test ("Block_Read_Write_Test", tm)); - ACE_NEW (test_vector[i++], Mmap1_Test ("Mmap1_Test", tm)); - ACE_NEW (test_vector[i++], Mmap2_Test ("Mmap2_Test", tm)); - ACE_NEW (test_vector[i++], Slow_Read_Write_Test ("Slow_Read_Write_Test", tm)); + ACE_NEW_RETURN (test_vector[i], Stdio_Test ("Stdio_Test", profile_timer), -1); + i++; + ACE_NEW_RETURN (test_vector[i], Block_Fread_Fwrite_Test ("Block_Fread_Fwrite_Test", profile_timer), -1); + i++; + ACE_NEW_RETURN (test_vector[i], Block_Read_Write_Test ("Block_Read_Write_Test", profile_timer), -1); + i++; + ACE_NEW_RETURN (test_vector[i], Mmap1_Test ("Mmap1_Test", profile_timer), -1); + i++; + ACE_NEW_RETURN (test_vector[i], Mmap2_Test ("Mmap2_Test", profile_timer), -1); + i++; + ACE_NEW_RETURN (test_vector[i], Slow_Read_Write_Test ("Slow_Read_Write_Test", profile_timer), -1); + i++; test_vector[i] = (IO_Test *) 0; for (i = 0; test_vector[i] != 0; i++) { if (ACE_OS::ftruncate (fileno (output_fp), 0) == -1) - ACE_ERROR ((LM_ERROR, "%s\n", "ftruncate")); + ACE_ERROR_RETURN ((LM_ERROR, "%s\n", "ftruncate"), -1); - cerr << "--------------------\n" - << "starting " << test_vector[i]->name () << " for " << iterations - << " iteration(s):\n"; + ACE_DEBUG ((LM_DEBUG, "--------------------\n" + "starting %s for %d iterations(s):\n", + test_vector[i]->name (), + iterations)); test_vector[i]->run_test (iterations, input_fp, output_fp); ACE_Profile_Timer::ACE_Elapsed_Time et; - tm.elapsed_time (et); + profile_timer.elapsed_time (et); - cerr << "wallclock time = " << et.real_time - << ", user time = " << et.user_time - << ", system time = " << et.system_time << endl; + ACE_DEBUG ((LM_DEBUG, "wallclock time = %f, user time = %f, system time = %f\n", + et.real_time, + et.user_time, + et.system_time)); delete test_vector[i]; } - cerr << "--------------------\n"; + ACE_DEBUG ((LM_DEBUG, "--------------------\n")); + return 0; } int @@ -145,7 +154,8 @@ main (int argc, char *argv[]) ACE_OS::unlink (output_filename); - run_tests (iteration_count, input_fp, output_fp); + if (run_tests (iteration_count, input_fp, output_fp) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run_tests"), -1); if (ACE_OS::fclose (input_fp) == -1 || ACE_OS::fclose (output_fp) == -1) |