Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / performance-tests / Synch-Benchmarks / synch_driver.cpp
blob6236cc8f2f006a238b70b33cfa89404153a8b8e7
1 // Driver program that measures the performance of synchronization
2 // mechanisms provided by ACE and the underlying OS.
4 #include "ace/Log_Msg.h"
5 #include "ace/Service_Config.h"
6 #include "ace/Service_Repository.h"
7 #include "Synch_Lib/Benchmark_Base.h"
9 #if defined (ACE_HAS_THREADS)
10 int
11 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
13 ACE_Service_Config::open (argc, argv);
14 ACE_Service_Repository_Iterator sri (*ACE_Service_Repository::instance ());
16 // Iteratively execute each service loaded in from the svc.conf
17 // file.
19 for (const ACE_Service_Type *sr;
20 sri.next (sr) != 0; )
22 // This would greatly benefit from RTTI typesafe downcasting...
23 const ACE_Service_Type_Impl *type = sr->type ();
24 const void *obj = type->object ();
25 ACE_Service_Object *so = (ACE_Service_Object *) obj;
26 Benchmark_Base *bb = (Benchmark_Base *) so;
28 if (bb->benchmark_type () == Benchmark_Base::METHOD)
30 Benchmark_Method_Base *bm = (Benchmark_Method_Base *) bb;
32 ACE_DEBUG ((LM_DEBUG, "\n\nExecuting %s\n", sr->name ()));
34 bm->exec (&sri);
36 else
37 sri.advance ();
39 return 0;
41 #else
42 int
43 ACE_TMAIN (int, ACE_TCHAR *[])
45 ACE_ERROR_RETURN ((LM_ERROR,
46 "This test requires the platform to have threads\n"), -1);
48 #endif /* ACE_HAS_THREADS */