diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-17 16:19:30 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-17 16:19:30 +0000 |
commit | 0aba9a5341cbd38b511bef4497d094daf3d6d00b (patch) | |
tree | 678604023fcb397c45022c2f7277fa78215532fd /performance-tests | |
parent | 4f8f578d856a2618181a14c508d698c126d93650 (diff) | |
download | ATCD-0aba9a5341cbd38b511bef4497d094daf3d6d00b.tar.gz |
Added context switch count
Diffstat (limited to 'performance-tests')
-rw-r--r-- | performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp | 28 | ||||
-rw-r--r-- | performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp | 25 |
2 files changed, 42 insertions, 11 deletions
diff --git a/performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp b/performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp index 598140e20f3..16b88f06e96 100644 --- a/performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp +++ b/performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp @@ -4,6 +4,7 @@ #include "ace/Get_Opt.h" #include "ace/High_Res_Timer.h" #include "ace/Sched_Params.h" +#include "ace/Profile_Timer.h" #include "../Latency_Stats.h" static size_t number_of_messages = 100; @@ -99,7 +100,8 @@ Leader_Follower_Task::svc (void) { ++burst; messages_in_this_burst = 0; - ACE_OS::sleep (timeout_between_bursts); + ACE_Time_Value tv (0, timeout_between_bursts); + ACE_OS::sleep (tv); } if (messages_in_this_burst == 0) @@ -244,8 +246,8 @@ main (int argc, ASYS_TCHAR *argv[]) Leader_Follower_Task *[number_of_threads], -1); - ACE_Rusage begin_rusage; - ACE_OS::getrusage (RUSAGE_SELF, &begin_rusage); + ACE_Profile_Timer timer; + timer.start (); int priority = (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + @@ -286,8 +288,9 @@ main (int argc, ASYS_TCHAR *argv[]) // Wait for all threads to terminate. result = ACE_Thread_Manager::instance ()->wait (); - ACE_Rusage end_rusage; - ACE_OS::getrusage (RUSAGE_SELF, &end_rusage); + timer.stop (); + ACE_Rusage rusage; + timer.elapsed_rusage (rusage); Latency_Stats latency; Throughput_Stats throughput; @@ -295,6 +298,8 @@ main (int argc, ASYS_TCHAR *argv[]) { latency.accumulate (leader_followers[i]->latency_stats_); throughput.accumulate (leader_followers[i]->throughput_stats_); + ACE_DEBUG ((LM_DEBUG, "Thread[%d]: ", i)); + leader_followers[i]->throughput_stats_.dump_results ("", ""); } ACE_DEBUG ((LM_DEBUG, "\nTotals for latency:\n")); @@ -302,10 +307,15 @@ main (int argc, ASYS_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, "\nTotals for throughput:\n")); throughput.dump_results (argv[0], "throughput"); - - ACE_DEBUG ((LM_DEBUG, "\nRusage %d/%d\n", - end_rusage.ru_nvcsw - begin_rusage.ru_nvcsw, - end_rusage.ru_nivcsw - begin_rusage.ru_nivcsw)); + + ACE_DEBUG ((LM_DEBUG, "\n(%t) Context switches %d/%d\n", +#if defined(ACE_HAS_PRUSAGE_T) + rusage.pr_vctx, + rusage.pr_ictx)); +#else + rusage.pr_vctx, + rusage.pr_ictx)); +#endif /* ACE_HAS_PRUSAGE_T */ for (i = 0; i < number_of_threads; ++i) { diff --git a/performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp b/performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp index 8f404a9009e..7eac44c7483 100644 --- a/performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp +++ b/performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp @@ -4,6 +4,7 @@ #include "ace/Get_Opt.h" #include "ace/High_Res_Timer.h" #include "ace/Sched_Params.h" +#include "ace/Profile_Timer.h" #include "../Latency_Stats.h" static size_t number_of_messages = 100; @@ -195,7 +196,8 @@ IO_Task::svc (void) } ++burst; - ACE_OS::sleep (timeout_between_bursts); + ACE_Time_Value tv (0, timeout_between_bursts); + ACE_OS::sleep (tv); } // Terminate messages. @@ -296,10 +298,13 @@ main (int argc, ASYS_TCHAR *argv[]) Worker_Task *[number_of_workers], -1); + ACE_Profile_Timer timer; + timer.start (); + int priority = (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); + // priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); long flags = THR_BOUND | THR_SCHED_FIFO; @@ -338,6 +343,7 @@ main (int argc, ASYS_TCHAR *argv[]) priority = (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; + priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); flags = THR_BOUND | THR_SCHED_FIFO; @@ -360,12 +366,18 @@ main (int argc, ASYS_TCHAR *argv[]) // Wait for all threads to terminate. result = ACE_Thread_Manager::instance ()->wait (); + timer.stop (); + ACE_Rusage rusage; + timer.elapsed_rusage (rusage); + Latency_Stats latency; Throughput_Stats throughput; for (i = 0; i < number_of_workers; ++i) { latency.accumulate (workers[i]->latency_stats_); throughput.accumulate (workers[i]->throughput_stats_); + ACE_DEBUG ((LM_DEBUG, "Thread[%d]: ", i)); + workers[i]->throughput_stats_.dump_results ("", ""); } ACE_DEBUG ((LM_DEBUG, "\nTotals for latency:\n")); @@ -374,6 +386,15 @@ main (int argc, ASYS_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, "\nTotals for throughput:\n")); throughput.dump_results (argv[0], "throughput"); + ACE_DEBUG ((LM_DEBUG, "\n(%t) Context switches %d/%d\n", +#if defined(ACE_HAS_PRUSAGE_T) + rusage.pr_vctx, + rusage.pr_ictx)); +#else + rusage.pr_vctx, + rusage.pr_ictx)); +#endif /* ACE_HAS_PRUSAGE_T */ + for (i = 0; i < number_of_workers; ++i) { delete workers[i]; |