diff options
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 17 | ||||
-rw-r--r-- | TAO/tests/Nested_Upcall_Crash/Client_Peer.cpp | 3 | ||||
-rw-r--r-- | TAO/tests/Nested_Upcall_Crash/Clock_Ticks.cpp | 35 | ||||
-rw-r--r-- | TAO/tests/Nested_Upcall_Crash/Clock_Ticks.h | 23 | ||||
-rw-r--r-- | TAO/tests/Nested_Upcall_Crash/Makefile | 37 | ||||
-rw-r--r-- | TAO/tests/Nested_Upcall_Crash/client.cpp | 3 | ||||
-rw-r--r-- | TAO/tests/Nested_Upcall_Crash/server.cpp | 3 |
7 files changed, 110 insertions, 11 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index b1021299d97..da7a5d32f3c 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,20 @@ +Wed Jun 19 11:52:55 2002 Carlos O'Ryan <coryan@atdesk.com> + + * tests/Nested_Upcall_Crash/Makefile: + * tests/Nested_Upcall_Crash/Clock_Ticks.h: + * tests/Nested_Upcall_Crash/Clock_Ticks.cpp: + Add a couple of functions to figure out the clock tick + resolution, first try sysconf() it is available, if that fails + try using the CLK_TCK macro (if defined), if that fails try to + use the HZ macro, if that fails fall back to some hardcoded + value. + + * tests/Nested_Upcall_Crash/Client_Peer.cpp: + * tests/Nested_Upcall_Crash/client.cpp: + * tests/Nested_Upcall_Crash/server.cpp: + Use the new Clock_Tick::* helper functions to figure out the + clock tick resolution. + Tue Jun 18 19:46:04 2002 Ossama Othman <ossama@uci.edu> * tests/Nested_Upcall_Crash/Makefile.bor: diff --git a/TAO/tests/Nested_Upcall_Crash/Client_Peer.cpp b/TAO/tests/Nested_Upcall_Crash/Client_Peer.cpp index dda139ac3cf..5a17fc6282d 100644 --- a/TAO/tests/Nested_Upcall_Crash/Client_Peer.cpp +++ b/TAO/tests/Nested_Upcall_Crash/Client_Peer.cpp @@ -7,6 +7,7 @@ * */ #include "Client_Peer.h" +#include "Clock_Ticks.h" #include "tao/ORB_Core.h" ACE_RCSID(Nested_Upcall_Crash, Client_Peer, "$Id$") @@ -53,7 +54,7 @@ Client_Peer::crash(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { Crasher * crasher = new Crasher; - ACE_Time_Value clk_tck (0, 1000000 / HZ); + ACE_Time_Value clk_tck (0, Clock_Ticks::get_usecs_per_tick ()); ACE_Reactor * reactor = this->orb_->orb_core()->reactor(); reactor->schedule_timer(crasher, 0, clk_tck); } diff --git a/TAO/tests/Nested_Upcall_Crash/Clock_Ticks.cpp b/TAO/tests/Nested_Upcall_Crash/Clock_Ticks.cpp new file mode 100644 index 00000000000..7f1b10dea24 --- /dev/null +++ b/TAO/tests/Nested_Upcall_Crash/Clock_Ticks.cpp @@ -0,0 +1,35 @@ +/** + * @file Clock_Ticks.cpp + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@atdesk.com> + * + */ +#include "Clock_Ticks.h" + +ACE_RCSID(Nested_Upcall_Crash, Clock_Ticks, "$Id$") + +int +Clock_Ticks::get_hz (void) +{ +#if defined(_SC_CLK_TCK) + int r = ACE_OS::sysconf(_SC_CLK_TCK); + if(r != -1) + return r; +#endif /* _SC_CLK_TCK */ + +#if defined(CLK_TCK) + return CLK_TCK; +#elif defined(HZ) + return HZ; +#else + return 100; // A good guess for most systems! +#endif /* CLK_TCK */ +} + +int +Clock_Ticks::get_usecs_per_tick (void) +{ + return 1000000 / get_hz (); +} diff --git a/TAO/tests/Nested_Upcall_Crash/Clock_Ticks.h b/TAO/tests/Nested_Upcall_Crash/Clock_Ticks.h new file mode 100644 index 00000000000..98e700da93b --- /dev/null +++ b/TAO/tests/Nested_Upcall_Crash/Clock_Ticks.h @@ -0,0 +1,23 @@ +#ifndef Clock_Ticks__h_ +#define Clock_Ticks__h_ +/** + * @file Clock_Ticks.h + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@atdesk.com> + * + */ + +#include "ace/OS.h" + +namespace Clock_Ticks +{ + /// Return the number of clock ticks per second + int get_hz (void); + + /// Return the number of microseconds per tick + int get_usecs_per_tick (void); +} + +#endif /* Clock_Ticks__h_ */ diff --git a/TAO/tests/Nested_Upcall_Crash/Makefile b/TAO/tests/Nested_Upcall_Crash/Makefile index cb4b936b751..8c79b60b095 100644 --- a/TAO/tests/Nested_Upcall_Crash/Makefile +++ b/TAO/tests/Nested_Upcall_Crash/Makefile @@ -16,11 +16,11 @@ IDL_FILES = Test IDL_SRC = TestC.cpp TestS.cpp BIN_UNCHECKED = client server scavenger -SRC = $(addsuffix .cpp, $(BIN_UNCHECKED) Client_Peer Server_Peer) $(IDL_SRC) +SRC = $(addsuffix .cpp, $(BIN_UNCHECKED) Client_Peer Server_Peer Clock_Ticks) $(IDL_SRC) -CLIENT_OBJS = client.o Client_Peer.o $(IDL_SRC:.cpp=.o) -SERVER_OBJS = server.o Server_Peer.o $(IDL_SRC:.cpp=.o) -SCAVENGER_OBJS = scavenger.o $(IDL_SRC:.cpp=.o) +CLIENT_OBJS = client.o Client_Peer.o Clock_Ticks.o $(IDL_SRC:.cpp=.o) +SERVER_OBJS = server.o Server_Peer.o Clock_Ticks.o $(IDL_SRC:.cpp=.o) +SCAVENGER_OBJS = scavenger.o Clock_Ticks.o TestC.o TAO_IDLFLAGS += -Ge 1 #---------------------------------------------------------------------------- @@ -53,7 +53,7 @@ client: $(addprefix $(VDIR),$(CLIENT_OBJS)) $(LINK.cc) $(LDFLAGS) -o $@ $^ -lTAO_Messaging $(TAO_SRVR_LIBS) $(POSTLINK) scavenger: $(addprefix $(VDIR),$(SCAVENGER_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ -lTAO_Messaging $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ -lTAO_Messaging $(TAO_CLNT_LIBS) $(POSTLINK) realclean: clean -$(RM) $(foreach ext, $(IDL_EXT), Test$(ext)) @@ -198,7 +198,7 @@ realclean: clean $(TAO_ROOT)/tao/PortableServer/Collocated_Object.h \ $(TAO_ROOT)/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h \ $(TAO_ROOT)/tao/PortableServer/Direct_Object_Proxy_Impl.h \ - TestS_T.h TestS_T.cpp TestS_T.i \ + TestS_T.h TestS_T.cpp TestS_T.i Clock_Ticks.h \ $(TAO_ROOT)/tao/Messaging/Messaging.h \ $(TAO_ROOT)/tao/Messaging/messaging_export.h \ $(TAO_ROOT)/tao/Messaging/MessagingC.h \ @@ -409,7 +409,7 @@ realclean: clean $(TAO_ROOT)/tao/PortableServer/Collocated_Object.h \ $(TAO_ROOT)/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h \ $(TAO_ROOT)/tao/PortableServer/Direct_Object_Proxy_Impl.h \ - TestS_T.h TestS_T.cpp TestS_T.i \ + TestS_T.h TestS_T.cpp TestS_T.i Clock_Ticks.h \ $(TAO_ROOT)/tao/Messaging/Messaging.h \ $(TAO_ROOT)/tao/Messaging/messaging_export.h \ $(TAO_ROOT)/tao/Messaging/MessagingC.h \ @@ -819,7 +819,7 @@ realclean: clean $(TAO_ROOT)/tao/PortableServer/Collocated_Object.h \ $(TAO_ROOT)/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h \ $(TAO_ROOT)/tao/PortableServer/Direct_Object_Proxy_Impl.h \ - TestS_T.h TestS_T.cpp TestS_T.i \ + TestS_T.h TestS_T.cpp TestS_T.i Clock_Ticks.h \ $(TAO_ROOT)/tao/ORB_Core.h \ $(TAO_ROOT)/tao/Policy_Manager.h \ $(TAO_ROOT)/tao/Policy_Set.h \ @@ -1023,6 +1023,27 @@ realclean: clean TestS_T.h TestS_T.cpp TestS_T.i \ $(TAO_ROOT)/tao/debug.h +.obj/Clock_Ticks.o .obj/Clock_Ticks.so .shobj/Clock_Ticks.o .shobj/Clock_Ticks.so: Clock_Ticks.cpp Clock_Ticks.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/ace_wchar.inl \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/OS_Memory.h \ + $(ACE_ROOT)/ace/OS_TLI.h \ + $(ACE_ROOT)/ace/Time_Value.h \ + $(ACE_ROOT)/ace/Default_Constants.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h + .obj/TestC.o .obj/TestC.so .shobj/TestC.o .shobj/TestC.so: TestC.cpp TestC.h \ $(TAO_ROOT)/tao/corba.h \ $(ACE_ROOT)/ace/pre.h \ diff --git a/TAO/tests/Nested_Upcall_Crash/client.cpp b/TAO/tests/Nested_Upcall_Crash/client.cpp index 7cb51eff503..42df6290f74 100644 --- a/TAO/tests/Nested_Upcall_Crash/client.cpp +++ b/TAO/tests/Nested_Upcall_Crash/client.cpp @@ -1,6 +1,7 @@ // $Id$ #include "Client_Peer.h" +#include "Clock_Ticks.h" #include "tao/Messaging/Messaging.h" #include "tao/ORB_Core.h" #include "ace/Get_Opt.h" @@ -121,7 +122,7 @@ main (int argc, char *argv[]) Timer timer(local_peer.in (), peer.in ()); - ACE_Time_Value interval(0, 50 * 1000000 / HZ); + ACE_Time_Value interval(0, 50 * Clock_Ticks::get_usecs_per_tick ()); ACE_Reactor * reactor = orb->orb_core()->reactor(); reactor->schedule_timer(&timer, 0, interval, interval); diff --git a/TAO/tests/Nested_Upcall_Crash/server.cpp b/TAO/tests/Nested_Upcall_Crash/server.cpp index a6e57d15933..cc9daade3ae 100644 --- a/TAO/tests/Nested_Upcall_Crash/server.cpp +++ b/TAO/tests/Nested_Upcall_Crash/server.cpp @@ -1,6 +1,7 @@ // $Id$ #include "Server_Peer.h" +#include "Clock_Ticks.h" #include "tao/Messaging/Messaging.h" #include "tao/ORB_Core.h" #include "ace/Get_Opt.h" @@ -197,7 +198,7 @@ Sleeper::handle_timeout (ACE_Time_Value const & , void const *) { // ACE_DEBUG((LM_DEBUG, "(%P|%t) - Sleeper::handle_timeout()\n")); - ACE_Time_Value clk_tck (0, 1000000 / HZ); + ACE_Time_Value clk_tck (0, Clock_Ticks::get_usecs_per_tick ()); this->orb_->perform_work(clk_tck); return 0; |