2 //=============================================================================
4 * @file Timeprobe_Test.cpp
6 * This is a simple test of ACE Timeprobes.
8 * @author Irfan Pyarali <irfan@cs.wustl.edu>
10 //=============================================================================
13 //#define ACE_ENABLE_TIMEPROBES
14 //#define ACE_MT_TIMEPROBES
15 //#define ACE_TSS_TIMEPROBES
17 #include "test_config.h"
18 #include "ace/Singleton.h"
19 #include "ace/Synch_Traits.h"
20 #include "ace/Recursive_Thread_Mutex.h"
21 #include "ace/Null_Mutex.h"
22 #include "ace/OS_NS_unistd.h"
23 #include "ace/Timeprobe.h"
26 #if defined (ACE_ENABLE_TIMEPROBES)
28 static const char *events_descriptions_0
[] =
56 static const char *events_descriptions_1
[] =
68 ACE_TIMEPROBE_EVENT_DESCRIPTIONS (events_descriptions_1
, WORK_START
);
69 ACE_TIMEPROBE_EVENT_DESCRIPTIONS (events_descriptions_0
, EVENT_ZERO
);
71 #endif /* ACE_ENABLE_TIMEPROBES */
76 ACE_FUNCTION_TIMEPROBE (WORK_START
);
80 #if !defined (ACE_HAS_PURIFY)
81 // Test creation of ACE_Singletons during static object construction.
82 // Timeprobes can do that, when they're enabled. Purify would notice
83 // the memory in use at program termination.
87 int *i
= ACE_Singleton
<int, ACE_SYNCH_RECURSIVE_MUTEX
>::instance ();
93 int static_singleton_creator
= create_singleton ();
94 #endif /* ! ACE_HAS_PURIFY */
97 run_main (int, ACE_TCHAR
*[])
99 ACE_START_TEST (ACE_TEXT ("Timeprobe_Test"));
101 ACE_TIMEPROBE ("Starting Test");
103 for (int i
= 0; i
< 3; i
++)
106 ACE_TIMEPROBE (EVENT_ZERO
+ i
);
109 ACE_TIMEPROBE ("Ending Test");