/**************************************************************************** ** TAU Portable Profiling Package ** ** http://www.cs.uoregon.edu/research/tau ** ***************************************************************************** ** Copyright 1997 ** ** Department of Computer and Information Science, University of Oregon ** ** Advanced Computing Laboratory, Los Alamos National Laboratory ** ****************************************************************************/ /*************************************************************************** ** File : RtsLayer.cpp ** ** Description : TAU Profiling Package RTS Layer definitions ** ** Contact : tau-team@cs.uoregon.edu ** ** Documentation : See http://www.cs.uoregon.edu/research/tau ** ***************************************************************************/ ////////////////////////////////////////////////////////////////////// // Include Files ////////////////////////////////////////////////////////////////////// #include #include //#define DEBUG_PROF #ifdef TAU_AIX #include "Profile/aix.h" #endif /* TAU_AIX */ #ifdef FUJITSU #include "Profile/fujitsu.h" #endif /* FUJITSU */ #ifdef TAU_HITACHI #include "Profile/hitachi.h" #endif /* HITACHI */ #include "Profile/Profiler.h" #if (defined(__QK_USER__) || defined(__LIBCATAMOUNT__ )) #ifndef TAU_CATAMOUNT #define TAU_CATAMOUNT #endif /* TAU_CATAMOUNT */ #include #endif /* __QK_USER__ || __LIBCATAMOUNT__ */ #ifdef CRAY_TIMERS #ifndef TAU_CATAMOUNT /* These header files are for Cray X1 */ #include #include #endif /* TAU_CATAMOUNT */ #endif // CRAY_TIMERS #ifdef TAU_XLC #define strcasecmp strcmp #define strncasecmp strncmp #endif /* TAU_XLC */ #ifdef TAU_DOT_H_LESS_HEADERS #include using namespace std; #else /* TAU_DOT_H_LESS_HEADERS */ #include #endif /* TAU_DOT_H_LESS_HEADERS */ #include #include #include #include #ifdef TAU_WINDOWS //include the header for windows time functions. #include //Various defines needed in Winbase.h. #include //For QueryPerformanceCounter/Frequency function (down to microsecond //resolution depending on the platform. #include //For _ftime function (millisecond resolution). //Map strncasecmp and strcasecmp to strnicmp and stricmp. #define strcasecmp stricmp #define strncasecmp strnicmp #endif //TAU_WINDOWS #if (!defined(TAU_WINDOWS)) #include #include #endif //TAU_WINDOWS #include #ifdef TAUKTAU #include #include #include #include #include #endif /* TAUKTAU */ ///////////////////////////////////////////////////////////////////////// // Member Function Definitions For class RtsLayer // Important for Porting to other platforms and frameworks. ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// TauGroup_t& RtsLayer::TheProfileMask(void) { // to avoid initialization problems of non-local static variables static TauGroup_t ProfileMask = TAU_DEFAULT; return ProfileMask; } ///////////////////////////////////////////////////////////////////////// bool& RtsLayer::TheEnableInstrumentation(void) { // to avoid initialization problems of non-local static variables static bool EnableInstrumentation = true; return EnableInstrumentation; } ///////////////////////////////////////////////////////////////////////// long RtsLayer::GenerateUniqueId(void) { /* This routine is called in a locked region (RtsLayer::LockDB/UnLockDB)*/ static long UniqueId = 0; return ++UniqueId; } ///////////////////////////////////////////////////////////////////////// int& RtsLayer::TheNode(void) { #ifdef TAU_SETNODE0 static int Node = 0; #else /* TAU_SETNODE0 */ static int Node =-1; #endif /* TAU_SETNODE0 */ return Node; } ///////////////////////////////////////////////////////////////////////// int& RtsLayer::TheContext(void) { static int Context = 0; return Context; } ///////////////////////////////////////////////////////////////////////// bool& RtsLayer::TheShutdown(void) { static bool shutdown = false; return shutdown; } ///////////////////////////////////////////////////////////////////////// ProfileMap_t& RtsLayer::TheProfileMap(void) { static ProfileMap_t *profilemap = new ProfileMap_t; return *profilemap; } ///////////////////////////////////////////////////////////////////////// TauGroup_t RtsLayer::getProfileGroup(char * ProfileGroup) { ProfileMap_t::iterator it = TheProfileMap().find(string(ProfileGroup)); TauGroup_t gr; if (it == TheProfileMap().end()) { #ifdef DEBUG_PROF cout < // #include // _syscall0(pid_t,gettid) // #endif int RtsLayer::getTid() { #ifdef __linux // return gettid(); return 0; #else return 0; #endif } const char *RtsLayer::getCounterName(int i) { const char *foo = TauMetrics_getMetricName(i); return TauMetrics_getMetricName(i); } void RtsLayer::getCurrentValues (int tid, double *values) { for (int c=0; c n)) stop = n; primary = groups.substr(start, stop - start) ; return primary; } ////////////////////////////////////////////////////////////////////// #ifdef __GNUC__ #ifndef NO_RTTI #include #endif /* NO_RTTI */ #endif /* __GNUC__ */ ///////////////////////////////////////////////////////////////////////// std::string RtsLayer::GetRTTI(const char *name) { #ifdef __GNUC__ #ifndef NO_RTTI std::size_t len; int stat; char *ptr = NULL; const std::string mangled = name; return abi::__cxa_demangle(mangled.c_str(), ptr, &len, &stat); #else /* NO_RTTI */ return string(name); #endif /* NO_RTTI */ #else return string(CheckNotNull(name)); #endif /* GNUC */ } /*************************************************************************** * $RCSfile: RtsLayer.cpp,v $ $Author: amorris $ * $Revision: 1.132 $ $Date: 2009/10/27 21:20:11 $ * POOMA_VERSION_ID: $Id: RtsLayer.cpp,v 1.132 2009/10/27 21:20:11 amorris Exp $ ***************************************************************************/