1 #include "ace/Get_Opt.h"
2 #include "ace/High_Res_Timer.h"
4 #include "ace/Throughput_Stats.h"
5 #include "ace/Sample_History.h"
6 #include "ace/Read_Buffer.h"
7 #include "ace/Array_Base.h"
9 #include "ace/OS_NS_unistd.h"
10 #include "tao/ORB_Core.h"
11 #include "tao/debug.h"
12 #include "tao/RTCORBA/RTCORBA.h"
13 #include "tao/RTCORBA/Priority_Mapping_Manager.h"
15 #include "tests/RTCORBA/common_args.cpp"
16 #include "tests/RTCORBA/check_supported_priorities.cpp"
17 #include "ace/Event.h"
21 AT_THREAD_CREATION
= 0,
22 AFTER_THREAD_CREATION
= 1
25 static const ACE_TCHAR
*ior
= ACE_TEXT("file://ior");
26 static const ACE_TCHAR
*rates_file
= ACE_TEXT("rates");
27 static const ACE_TCHAR
*invocation_priorities_file
= ACE_TEXT("empty-file");
28 static int shutdown_server
= 0;
29 static int do_dump_history
= 0;
30 static ACE_High_Res_Timer::global_scale_factor_type gsf
= 0;
31 static CORBA::ULong continuous_workers
= 0;
33 static CORBA::ULong time_for_test
= 10;
34 static CORBA::ULong work
= 10;
35 static CORBA::ULong max_throughput_timeout
= 5;
36 static CORBA::ULong continuous_worker_priority
= 0;
37 static int set_priority
= 1;
38 static Priority_Setting priority_setting
= AFTER_THREAD_CREATION
;
39 static int individual_continuous_worker_stats
= 0;
40 static int print_missed_invocations
= 0;
41 static ACE_hrtime_t test_start
;
42 static CORBA::ULong prime_number
= 9619;
43 static int count_missed_end_deadlines
= 0;
51 number_of_workers_ (0)
55 TAO_SYNCH_MUTEX worker_lock_
;
57 CORBA::ULong workers_ready_
;
58 CORBA::ULong number_of_workers_
;
62 parse_args (int argc
, ACE_TCHAR
*argv
[])
64 ACE_Get_Opt
get_opts (argc
, argv
,
65 "c:e:g:hi:k:m:p:q:r:t:u:v:w:x:y:z:" //client options
66 "b:f:hl:n:o:s:" // server options
70 while ((c
= get_opts ()) != -1)
75 ACE_OS::atoi (get_opts
.opt_arg ());
79 count_missed_end_deadlines
=
80 ACE_OS::atoi (get_opts
.opt_arg ());
85 ACE_OS::atoi (get_opts
.opt_arg ());
89 individual_continuous_worker_stats
=
90 ACE_OS::atoi (get_opts
.opt_arg ());
99 print_missed_invocations
=
100 ACE_OS::atoi (get_opts
.opt_arg ());
104 invocation_priorities_file
=
110 ACE_OS::atoi (get_opts
.opt_arg ());
120 ACE_OS::atoi (get_opts
.opt_arg ());
124 continuous_worker_priority
=
125 ACE_OS::atoi (get_opts
.opt_arg ());
130 Priority_Setting (ACE_OS::atoi (get_opts
.opt_arg ()));
135 ACE_OS::atoi (get_opts
.opt_arg ());
140 ACE_OS::atoi (get_opts
.opt_arg ());
145 ACE_OS::atoi (get_opts
.opt_arg ());
149 max_throughput_timeout
=
150 ACE_OS::atoi (get_opts
.opt_arg ());
159 // server options: ignored.
165 ACE_ERROR_RETURN ((LM_ERROR
,
167 "\t-c <number of continuous workers> (defaults to %d)\n"
168 "\t-e <count missed end deadlines> (defaults to %d)\n"
169 "\t-g <show history> (defaults to %d)\n"
170 "\t-h <help: shows options menu>\n"
171 "\t-i <print stats of individual continuous workers> (defaults to %d)\n"
172 "\t-k <ior> (defaults to %s)\n"
173 "\t-m <print missed invocations for paced workers> (defaults to %d)\n"
174 "\t-p <invocation priorities file> (defaults to %s)\n"
175 "\t-q <prime number> (defaults to %d)\n"
176 "\t-r <rates file> (defaults to %s)\n"
177 "\t-t <time for test> (defaults to %d)\n"
178 "\t-u <continuous worker priority> (defaults to %d)\n"
179 "\t-v <priority setting: AT_THREAD_CREATION = 0, AFTER_THREAD_CREATION = 1> (defaults to %s)\n"
180 "\t-w <work> (defaults to %d)\n"
181 "\t-x <shutdown server> (defaults to %d)\n"
182 "\t-y <set invocation priorities> (defaults to %d)\n"
183 "\t-z <timeout for max throughput measurement> (defaults to %d)\n"
187 count_missed_end_deadlines
,
189 individual_continuous_worker_stats
,
191 print_missed_invocations
,
192 invocation_priorities_file
,
196 continuous_worker_priority
,
197 priority_setting
== 0 ? "AT_THREAD_CREATION" : "AFTER_THREAD_CREATION",
201 max_throughput_timeout
),
209 to_seconds (ACE_UINT64 hrtime
,
210 ACE_High_Res_Timer::global_scale_factor_type sf
)
213 static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (hrtime
/ sf
));
214 seconds
/= ACE_HR_SCALE_CONVERSION
;
220 to_hrtime (double seconds
,
221 ACE_High_Res_Timer::global_scale_factor_type sf
)
223 return ACE_UINT64 (seconds
* sf
* ACE_HR_SCALE_CONVERSION
);
227 start_synchronization (test_ptr test
,
228 Synchronizers
&synchronizers
)
230 CORBA::ULong synchronization_iterations
= 1;
233 for (CORBA::ULong i
= 0;
234 i
< synchronization_iterations
;
241 catch (const CORBA::Exception
& ex
)
243 ex
._tao_print_exception ("Exception caught:");
248 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
250 synchronizers
.worker_lock_
,
253 if (synchronizers
.workers_ready_
== 0)
255 if (TAO_debug_level
> 0)
256 ACE_DEBUG ((LM_DEBUG
,
260 ++synchronizers
.workers_ready_
;
262 if (TAO_debug_level
> 0)
263 ACE_DEBUG ((LM_DEBUG
,
265 synchronizers
.workers_ready_
));
267 if (synchronizers
.workers_ready_
==
268 synchronizers
.number_of_workers_
)
270 if (TAO_debug_level
> 0)
271 ACE_DEBUG ((LM_DEBUG
,
275 ACE_OS::gethrtime ();
277 synchronizers
.workers_
.signal ();
283 synchronizers
.workers_
.wait ();
289 end_synchronization (Synchronizers
&synchronizers
)
292 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
294 synchronizers
.worker_lock_
,
297 if (synchronizers
.workers_ready_
==
298 synchronizers
.number_of_workers_
)
300 if (TAO_debug_level
> 0)
301 ACE_DEBUG ((LM_DEBUG
,
304 synchronizers
.workers_
.reset ();
307 if (TAO_debug_level
> 0)
308 ACE_DEBUG ((LM_DEBUG
,
309 "%d worker completed\n",
310 synchronizers
.workers_ready_
));
312 --synchronizers
.workers_ready_
;
314 if (synchronizers
.workers_ready_
== 0)
316 if (TAO_debug_level
> 0)
317 ACE_DEBUG ((LM_DEBUG
,
320 synchronizers
.workers_
.signal ();
326 synchronizers
.workers_
.wait ();
332 max_throughput (test_ptr test
,
333 RTCORBA::Current_ptr current
,
334 RTCORBA::PriorityMapping
&priority_mapping
,
335 CORBA::ULong
&max_rate
)
337 CORBA::ULong calls_made
= 0;
338 CORBA::Short CORBA_priority
= 0;
339 CORBA::Short native_priority
= 0;
344 current
->the_priority ();
346 CORBA::Boolean result
=
347 priority_mapping
.to_native (CORBA_priority
,
350 ACE_ERROR_RETURN ((LM_ERROR
,
351 "Error in converting CORBA priority %d to native priority\n",
356 ACE_OS::gethrtime ();
360 to_hrtime (max_throughput_timeout
, gsf
);
365 ACE_OS::gethrtime ();
376 catch (const CORBA::Exception
& ex
)
378 ex
._tao_print_exception ("Exception caught:");
383 calls_made
/ max_throughput_timeout
;
385 ACE_DEBUG ((LM_DEBUG
,
386 "\nPriority = %d/%d; Max rate calculations => %d calls in %d seconds; Max rate = %.2f\n",
390 max_throughput_timeout
,
391 calls_made
/ (double) max_throughput_timeout
));
400 Paced_Worker (ACE_Thread_Manager
&thread_manager
,
403 CORBA::ULong iterations
,
404 CORBA::Short priority
,
405 RTCORBA::Current_ptr current
,
406 RTCORBA::PriorityMapping
&priority_mapping
,
407 Synchronizers
&synchronizers
);
410 ACE_hrtime_t
deadline_for_current_call (CORBA::ULong i
);
411 void reset_priority ();
412 void print_stats (ACE_hrtime_t test_end
);
414 void missed_start_deadline (CORBA::ULong invocation
);
415 void missed_end_deadline (CORBA::ULong invocation
);
419 ACE_Sample_History history_
;
420 CORBA::Short priority_
;
421 RTCORBA::Current_var current_
;
422 RTCORBA::PriorityMapping
&priority_mapping_
;
423 Synchronizers
&synchronizers_
;
424 CORBA::Short CORBA_priority_
;
425 CORBA::Short native_priority_
;
426 ACE_hrtime_t interval_between_calls_
;
427 CORBA::ULong missed_start_deadlines_
;
428 CORBA::ULong missed_end_deadlines_
;
430 typedef ACE_Array_Base
<CORBA::ULong
> Missed_Invocations
;
431 Missed_Invocations missed_start_invocations_
;
432 Missed_Invocations missed_end_invocations_
;
435 Paced_Worker::Paced_Worker (ACE_Thread_Manager
&thread_manager
,
438 CORBA::ULong iterations
,
439 CORBA::Short priority
,
440 RTCORBA::Current_ptr current
,
441 RTCORBA::PriorityMapping
&priority_mapping
,
442 Synchronizers
&synchronizers
)
443 : ACE_Task_Base (&thread_manager
),
444 test_ (test::_duplicate (test
)),
446 history_ (iterations
),
447 priority_ (priority
),
448 current_ (RTCORBA::Current::_duplicate (current
)),
449 priority_mapping_ (priority_mapping
),
450 synchronizers_ (synchronizers
),
452 native_priority_ (0),
453 interval_between_calls_ (),
454 missed_start_deadlines_ (0),
455 missed_end_deadlines_ (0),
456 missed_start_invocations_ (iterations
),
457 missed_end_invocations_ (iterations
)
459 this->interval_between_calls_
=
460 to_hrtime (1 / double (this->rate_
), gsf
);
464 Paced_Worker::reset_priority ()
468 this->current_
->the_priority (this->priority_
);
472 this->current_
->the_priority (continuous_worker_priority
);
477 Paced_Worker::deadline_for_current_call (CORBA::ULong i
)
479 ACE_hrtime_t deadline_for_current_call
=
480 this->interval_between_calls_
;
482 deadline_for_current_call
*= i
;
484 deadline_for_current_call
+= test_start
;
486 return deadline_for_current_call
;
490 Paced_Worker::print_stats (ACE_hrtime_t test_end
)
492 ACE_GUARD (TAO_SYNCH_MUTEX
,
494 this->synchronizers_
.worker_lock_
);
496 CORBA::ULong missed_total_deadlines
=
497 this->missed_start_deadlines_
+ this->missed_end_deadlines_
;
499 CORBA::ULong made_total_deadlines
=
500 this->history_
.max_samples () - missed_total_deadlines
;
502 ACE_DEBUG ((LM_DEBUG
,
503 "\n************ Statistics for thread %t ************\n\n"));
505 ACE_DEBUG ((LM_DEBUG
,
506 "Priority = %d/%d; Rate = %d/sec; Iterations = %d; ",
507 this->CORBA_priority_
,
508 this->native_priority_
,
510 this->history_
.max_samples ()));
512 if (count_missed_end_deadlines
)
513 ACE_DEBUG ((LM_DEBUG
,
514 "Deadlines made/missed[start,end]/%% = %d/%d[%d,%d]/%.2f%%; Effective Rate = %.2f\n",
515 made_total_deadlines
,
516 missed_total_deadlines
,
517 this->missed_start_deadlines_
,
518 this->missed_end_deadlines_
,
519 made_total_deadlines
* 100 / (double) this->history_
.max_samples (),
520 made_total_deadlines
/ to_seconds (test_end
- test_start
, gsf
)));
522 ACE_DEBUG ((LM_DEBUG
,
523 "Deadlines made/missed/%% = %d/%d/%.2f%%; Effective Rate = %.2f\n",
524 made_total_deadlines
,
525 missed_total_deadlines
,
526 made_total_deadlines
* 100 / (double) this->history_
.max_samples (),
527 made_total_deadlines
/ to_seconds (test_end
- test_start
, gsf
)));
532 this->history_
.dump_samples (ACE_TEXT("HISTORY"), gsf
);
535 ACE_Basic_Stats stats
;
536 this->history_
.collect_basic_stats (stats
);
537 stats
.dump_results (ACE_TEXT("Total"), gsf
);
539 ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf
,
540 test_end
- test_start
,
541 stats
.samples_count ());
543 if (print_missed_invocations
)
545 ACE_DEBUG ((LM_DEBUG
, "\nMissed start invocations are: "));
547 for (CORBA::ULong j
= 0;
548 j
!= this->missed_start_deadlines_
;
551 ACE_DEBUG ((LM_DEBUG
,
553 this->missed_start_invocations_
[j
]));
556 ACE_DEBUG ((LM_DEBUG
, "\n"));
558 if (count_missed_end_deadlines
)
560 ACE_DEBUG ((LM_DEBUG
, "\nMissed end invocations are: "));
562 for (CORBA::ULong j
= 0;
563 j
!= this->missed_end_deadlines_
;
566 ACE_DEBUG ((LM_DEBUG
,
568 this->missed_end_invocations_
[j
]));
571 ACE_DEBUG ((LM_DEBUG
, "\n"));
577 Paced_Worker::setup ()
579 if (priority_setting
== AFTER_THREAD_CREATION
)
581 this->reset_priority ();
584 this->CORBA_priority_
=
585 this->current_
->the_priority ();
587 CORBA::Boolean result
=
588 this->priority_mapping_
.to_native (this->CORBA_priority_
,
589 this->native_priority_
);
591 ACE_ERROR_RETURN ((LM_ERROR
,
592 "Error in converting CORBA priority %d to native priority\n",
593 this->CORBA_priority_
),
597 start_synchronization (this->test_
.in (),
598 this->synchronizers_
);
602 Paced_Worker::missed_start_deadline (CORBA::ULong invocation
)
604 this->missed_start_invocations_
[this->missed_start_deadlines_
++] =
609 Paced_Worker::missed_end_deadline (CORBA::ULong invocation
)
611 if (count_missed_end_deadlines
)
612 this->missed_end_invocations_
[this->missed_end_deadlines_
++] =
627 for (CORBA::ULong i
= 0;
628 i
!= this->history_
.max_samples ();
631 ACE_hrtime_t deadline_for_current_call
=
632 this->deadline_for_current_call (i
);
634 ACE_hrtime_t time_before_call
=
635 ACE_OS::gethrtime ();
637 if (time_before_call
> deadline_for_current_call
)
639 this->missed_start_deadline (i
+ 1);
643 this->test_
->method (work
,
646 ACE_hrtime_t time_after_call
=
647 ACE_OS::gethrtime ();
648 this->history_
.sample (time_after_call
- time_before_call
);
650 if (time_after_call
> deadline_for_current_call
)
652 this->missed_end_deadline (i
+ 1);
656 ACE_hrtime_t sleep_time
=
657 deadline_for_current_call
- time_after_call
;
659 ACE_OS::sleep (ACE_Time_Value (0,
660 long (to_seconds (sleep_time
, gsf
) *
661 ACE_ONE_SECOND_IN_USECS
)));
664 ACE_hrtime_t test_end
= ACE_OS::gethrtime ();
668 end_synchronization (this->synchronizers_
);
670 this->print_stats (test_end
);
672 catch (const CORBA::Exception
& ex
)
674 ex
._tao_print_exception ("Exception caught:");
681 class Continuous_Worker
:
685 Continuous_Worker (ACE_Thread_Manager
&thread_manager
,
687 CORBA::ULong iterations
,
688 RTCORBA::Current_ptr current
,
689 RTCORBA::PriorityMapping
&priority_mapping
,
690 Synchronizers
&synchronizers
);
693 void print_stats (ACE_Sample_History
&history
,
694 ACE_hrtime_t test_end
);
696 void print_collective_stats ();
699 CORBA::ULong iterations_
;
700 RTCORBA::Current_var current_
;
701 RTCORBA::PriorityMapping
&priority_mapping_
;
702 Synchronizers
&synchronizers_
;
703 CORBA::Short CORBA_priority_
;
704 CORBA::Short native_priority_
;
705 ACE_Basic_Stats collective_stats_
;
706 ACE_hrtime_t time_for_test_
;
709 Continuous_Worker::Continuous_Worker (ACE_Thread_Manager
&thread_manager
,
711 CORBA::ULong iterations
,
712 RTCORBA::Current_ptr current
,
713 RTCORBA::PriorityMapping
&priority_mapping
,
714 Synchronizers
&synchronizers
)
715 : ACE_Task_Base (&thread_manager
),
716 test_ (test::_duplicate (test
)),
717 iterations_ (iterations
),
718 current_ (RTCORBA::Current::_duplicate (current
)),
719 priority_mapping_ (priority_mapping
),
720 synchronizers_ (synchronizers
),
722 native_priority_ (0),
723 collective_stats_ (),
729 Continuous_Worker::print_stats (ACE_Sample_History
&history
,
730 ACE_hrtime_t test_end
)
732 ACE_GUARD (TAO_SYNCH_MUTEX
,
734 this->synchronizers_
.worker_lock_
);
736 if (individual_continuous_worker_stats
)
738 ACE_DEBUG ((LM_DEBUG
,
739 "\n************ Statistics for thread %t ************\n\n"));
741 ACE_DEBUG ((LM_DEBUG
,
743 history
.sample_count ()));
747 history
.dump_samples (ACE_TEXT("HISTORY"), gsf
);
750 ACE_Basic_Stats stats
;
751 history
.collect_basic_stats (stats
);
752 stats
.dump_results (ACE_TEXT("Total"), gsf
);
754 ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf
,
755 test_end
- test_start
,
756 stats
.samples_count ());
759 history
.collect_basic_stats (this->collective_stats_
);
760 ACE_hrtime_t elapsed_time_for_current_thread
=
761 test_end
- test_start
;
762 if (elapsed_time_for_current_thread
> this->time_for_test_
)
763 this->time_for_test_
= elapsed_time_for_current_thread
;
767 Continuous_Worker::print_collective_stats ()
769 if (continuous_workers
> 0)
771 ACE_DEBUG ((LM_DEBUG
,
772 "\n************ Statistics for continuous workers ************\n\n"));
774 ACE_DEBUG ((LM_DEBUG
,
775 "Priority = %d/%d; Collective iterations = %d; Workers = %d; Average = %d\n",
776 this->CORBA_priority_
,
777 this->native_priority_
,
778 this->collective_stats_
.samples_count (),
780 this->collective_stats_
.samples_count () /
781 continuous_workers
));
783 this->collective_stats_
.dump_results (ACE_TEXT("Collective"), gsf
);
785 ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Individual"), gsf
,
786 this->time_for_test_
,
787 this->collective_stats_
.samples_count () /
790 ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Collective"), gsf
,
791 this->time_for_test_
,
792 this->collective_stats_
.samples_count ());
797 Continuous_Worker::setup ()
799 if (priority_setting
== AFTER_THREAD_CREATION
)
801 this->current_
->the_priority (continuous_worker_priority
);
804 this->CORBA_priority_
=
805 this->current_
->the_priority ();
807 CORBA::Boolean result
=
808 this->priority_mapping_
.to_native (this->CORBA_priority_
,
809 this->native_priority_
);
811 ACE_ERROR_RETURN ((LM_ERROR
,
812 "Error in converting CORBA priority %d to native priority\n",
813 this->CORBA_priority_
),
817 start_synchronization (this->test_
.in (),
818 this->synchronizers_
);
822 Continuous_Worker::svc ()
826 ACE_Sample_History
history (this->iterations_
);
834 for (CORBA::ULong i
= 0;
835 i
!= history
.max_samples () && !done
;
838 ACE_hrtime_t start
= ACE_OS::gethrtime ();
840 this->test_
->method (work
,
843 ACE_hrtime_t end
= ACE_OS::gethrtime ();
844 history
.sample (end
- start
);
847 ACE_hrtime_t test_end
= ACE_OS::gethrtime ();
849 end_synchronization (this->synchronizers_
);
851 this->print_stats (history
,
854 catch (const CORBA::Exception
& ex
)
856 ex
._tao_print_exception ("Exception caught:");
863 class Task
: public ACE_Task_Base
866 Task (ACE_Thread_Manager
&thread_manager
,
874 Task::Task (ACE_Thread_Manager
&thread_manager
,
876 : ACE_Task_Base (&thread_manager
),
877 orb_ (CORBA::ORB::_duplicate (orb
))
884 Synchronizers synchronizers
;
886 gsf
= ACE_High_Res_Timer::global_scale_factor ();
890 CORBA::Object_var object
=
891 this->orb_
->string_to_object (ior
);
894 test::_narrow (object
.in ());
897 this->orb_
->resolve_initial_references ("RTCurrent");
899 RTCORBA::Current_var current
=
900 RTCORBA::Current::_narrow (object
.in ());
903 this->orb_
->resolve_initial_references ("PriorityMappingManager");
905 RTCORBA::PriorityMappingManager_var mapping_manager
=
906 RTCORBA::PriorityMappingManager::_narrow (object
.in ());
908 RTCORBA::PriorityMapping
&priority_mapping
=
909 *mapping_manager
->mapping ();
913 get_values ("client",
921 ULong_Array invocation_priorities
;
923 get_values ("client",
924 invocation_priorities_file
,
925 "invocation priorities",
926 invocation_priorities
,
931 if (invocation_priorities
.size () != 0 &&
932 invocation_priorities
.size () != rates
.size ())
933 ACE_ERROR_RETURN ((LM_ERROR
,
934 "Number of invocation priorities (%d) != Number of rates (%d)\n",
935 invocation_priorities
.size (),
939 synchronizers
.number_of_workers_
=
940 rates
.size () + continuous_workers
;
942 CORBA::ULong max_rate
= 0;
944 max_throughput (test
.in (),
951 CORBA::Short priority_range
=
952 RTCORBA::maxPriority
- RTCORBA::minPriority
;
954 ACE_Thread_Manager paced_workers_manager
;
957 Paced_Worker
**paced_workers
=
958 new Paced_Worker
*[rates
.size ()];
964 CORBA::Short priority
= 0;
966 if (invocation_priorities
.size () == 0)
968 CORBA::Short ((priority_range
/
969 double (rates
.size ())) *
973 invocation_priorities
[i
];
976 new Paced_Worker (paced_workers_manager
,
979 time_for_test
* rates
[i
],
986 ACE_Thread_Manager continuous_workers_manager
;
987 Continuous_Worker
continuous_worker (continuous_workers_manager
,
989 max_rate
* time_for_test
,
996 this->orb_
->orb_core ()->orb_params ()->thread_creation_flags ();
998 CORBA::Short CORBA_priority
=
999 continuous_worker_priority
;
1000 CORBA::Short native_priority
;
1001 CORBA::Boolean convert_result
=
1002 priority_mapping
.to_native (CORBA_priority
,
1004 if (!convert_result
)
1005 ACE_ERROR_RETURN ((LM_ERROR
,
1006 "Error in converting CORBA priority %d to native priority\n",
1010 int force_active
= 0;
1012 if (priority_setting
== AT_THREAD_CREATION
)
1015 continuous_worker
.activate (flags
,
1020 ACE_ERROR_RETURN ((LM_ERROR
,
1021 "Continuous_Worker::activate failed\n"),
1027 continuous_worker
.activate (flags
,
1028 continuous_workers
);
1030 ACE_ERROR_RETURN ((LM_ERROR
,
1031 "Continuous_Worker::activate failed\n"),
1038 this->orb_
->orb_core ()->orb_params ()->thread_creation_flags ();
1044 if (priority_setting
== AT_THREAD_CREATION
)
1049 paced_workers
[i
]->priority_
;
1052 priority_mapping
.to_native (CORBA_priority
,
1054 if (!convert_result
)
1055 ACE_ERROR_RETURN ((LM_ERROR
,
1056 "Error in converting CORBA priority %d to native priority\n",
1062 paced_workers
[i
]->activate (flags
,
1067 ACE_ERROR_RETURN ((LM_ERROR
,
1068 "Paced_Worker::activate failed\n"),
1074 paced_workers
[i
]->activate (flags
);
1076 ACE_ERROR_RETURN ((LM_ERROR
,
1077 "Paced_Worker::activate failed\n"),
1082 if (rates
.size () != 0)
1084 paced_workers_manager
.wait ();
1087 continuous_workers_manager
.wait ();
1089 continuous_worker
.print_collective_stats ();
1095 delete paced_workers
[i
];
1097 delete[] paced_workers
;
1099 if (shutdown_server
)
1104 catch (const CORBA::Exception
& ex
)
1106 ex
._tao_print_exception ("Exception caught:");
1114 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
1118 CORBA::ORB_var orb
=
1119 CORBA::ORB_init (argc
, argv
);
1122 parse_args (argc
, argv
);
1126 // Make sure we can support multiple priorities that are required
1128 check_supported_priorities (orb
.in ());
1130 // Thread Manager for managing task.
1131 ACE_Thread_Manager thread_manager
;
1134 Task
task (thread_manager
,
1137 // Task activation flags.
1141 orb
->orb_core ()->orb_params ()->thread_creation_flags ();
1145 task
.activate (flags
);
1146 ACE_ASSERT (result
!= -1);
1147 ACE_UNUSED_ARG (result
);
1149 // Wait for task to exit.
1151 thread_manager
.wait ();
1152 ACE_ASSERT (result
!= -1);
1154 catch (const CORBA::Exception
& ex
)
1156 ex
._tao_print_exception ("Exception caught:");