Browse Source

more tau for windows

David Rose 19 years ago
parent
commit
cadbb022f8

+ 1 - 1
dtool/Config.Win32.pp

@@ -11,7 +11,7 @@
 #define SYSTEM_IGATE_FLAGS -longlong __int64 -D_X86_ -DWIN32_VC -D"_declspec(param)=" -D"__declspec(param)=" -D_near  -D_far -D__near  -D__far -D_WIN32 -D__stdcall -Dvolatile=
 #define SYSTEM_IGATE_FLAGS -longlong __int64 -D_X86_ -DWIN32_VC -D"_declspec(param)=" -D"__declspec(param)=" -D_near  -D_far -D__near  -D__far -D_WIN32 -D__stdcall -Dvolatile=
 
 
 // Additional flags to pass to the Tau instrumentor.
 // Additional flags to pass to the Tau instrumentor.
-#define TAU_INSTRUMENTOR_FLAGS -DWIN32_VC -D_WIN32 -D__cdecl= -D__stdcall= -D__fastcall= -D__i386 -D_MSC_VER=1310 -D_W64=  -D_INTEGRAL_MAX_BITS=64 --exceptions --late_tiebreaker --no_class_name_injection --no_warnings --restrict --microsoft --new_for_init
+#define TAU_INSTRUMENTOR_FLAGS -DTAU_USE_C_API -DPROFILING_ON -DWIN32_VC -D_WIN32 -D__cdecl= -D__stdcall= -D__fastcall= -D__i386 -D_MSC_VER=1310 -D_W64=  -D_INTEGRAL_MAX_BITS=64 --exceptions --late_tiebreaker --no_class_name_injection --no_warnings --restrict --microsoft --new_for_init
 
 
 // Is the platform big-endian (like an SGI workstation) or
 // Is the platform big-endian (like an SGI workstation) or
 // little-endian (like a PC)?  Define this to the empty string to
 // little-endian (like a PC)?  Define this to the empty string to

+ 10 - 2
dtool/Config.pp

@@ -643,9 +643,17 @@
 #define HAVE_AUDIO 1
 #define HAVE_AUDIO 1
 
 
 // The Tau profiler provides a multiplatform, thread-aware profiler.
 // The Tau profiler provides a multiplatform, thread-aware profiler.
-// To use it, define TAU_MAKEFILE appropriately, define USE_TAU to 1,
-// and rebuild the code with ppremake; make install.
+// To use it, define USE_TAU to 1, and set TAU_MAKEFILE to the
+// filename that contains the Tau-provided Makefile for your platform.
+// Then rebuild the code with ppremake; make install.  Alternatively,
+// instead of setting TAU_MAKEFILE, you can also define TAU_ROOT and
+// PDT_ROOT, to point to the root directory of the tau and pdtoolkit
+// installations, respectively; then the individual Tau components
+// will be invoked directly.  This is especially useful on Windows,
+// where there is no Tau Makefile.
 #define TAU_MAKEFILE
 #define TAU_MAKEFILE
+#define TAU_ROOT
+#define PDT_ROOT
 #define TAU_OPTS -optKeepFiles
 #define TAU_OPTS -optKeepFiles
 #define TAU_CFLAGS -D_GNU_SOURCE
 #define TAU_CFLAGS -D_GNU_SOURCE
 #define USE_TAU
 #define USE_TAU

+ 2 - 2
dtool/pptempl/Global.gmsvc.pp

@@ -124,9 +124,9 @@
 #defer extra_cflags /EHsc /Zm500 /DWIN32_VC /DWIN32 $[WARNING_LEVEL_FLAG] $[END_CFLAGS]
 #defer extra_cflags /EHsc /Zm500 /DWIN32_VC /DWIN32 $[WARNING_LEVEL_FLAG] $[END_CFLAGS]
 
 
 #if $[direct_tau]
 #if $[direct_tau]
-#define tau_ipath $[ROOT_TAU]/include
+#define tau_ipath $[TAU_ROOT]/include
 #define tau_cflags /DPROFILING_ON /DTAU_STDCXXLIB /DTAU_USE_C_API
 #define tau_cflags /DPROFILING_ON /DTAU_STDCXXLIB /DTAU_USE_C_API
-#define tau_lpath $[ROOT_TAU]/lib/VC7
+#define tau_lpath $[TAU_ROOT]/lib/VC7
 #define tau_libs tau-profile.lib
 #define tau_libs tau-profile.lib
 #else  // direct_tau
 #else  // direct_tau
 #define tau_ipath
 #define tau_ipath

+ 1 - 1
dtool/pptempl/Template.gmsvc.pp

@@ -878,7 +878,7 @@ $[pdb_source] : $[il_source]
 $[TAB] $[TAU_MAKE_PDB]
 $[TAB] $[TAU_MAKE_PDB]
 
 
 $[inst_source] : $[pdb_source]
 $[inst_source] : $[pdb_source]
-$[TAB] $[TAU_MAKE_INST] -c
+$[TAB] $[TAU_MAKE_INST] -c++
 
 
 $[target] : $[inst_source] $[get_depends $[source]]
 $[target] : $[inst_source] $[get_depends $[source]]
 #define source $[inst_source]
 #define source $[inst_source]

+ 3 - 3
dtool/pptempl/compilerSettings.pp

@@ -224,6 +224,6 @@
 #endif
 #endif
 
 
 #defer tau_opts $[decygwin %,-I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]] $[building_var:%=-D%]
 #defer tau_opts $[decygwin %,-I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]] $[building_var:%=-D%]
-#defer TAU_MAKE_IL $[ROOT_PDT]/Windows/bin/edgcpfe -o $[il_source] $[tau_opts] $[cdefines:%=-D%] $[TAU_INSTRUMENTOR_FLAGS] $[source]
-#defer TAU_MAKE_PDB $[ROOT_PDT]/Windows/bin/taucpdisp $[il_source] > $[pdb_source]
-#defer TAU_MAKE_INST $[ROOT_TAU]/bin/tau_instrumentor $[pdb_source] $[source] -o $[inst_source]
+#defer TAU_MAKE_IL $[PDT_ROOT]/Windows/bin/edgcpfe -o $[il_source] $[tau_opts] $[cdefines:%=-D%] $[TAU_INSTRUMENTOR_FLAGS] $[source]
+#defer TAU_MAKE_PDB $[PDT_ROOT]/Windows/bin/taucpdisp $[il_source] > $[pdb_source]
+#defer TAU_MAKE_INST $[TAU_ROOT]/bin/tau_instrumentor $[pdb_source] $[source] -o $[inst_source]

+ 1 - 0
dtool/src/dtoolbase/dtoolbase.h

@@ -142,6 +142,7 @@
 /* If we're building with the Tau instrumentor, include the
 /* If we're building with the Tau instrumentor, include the
    appropriate header file to pick up the TAU macros. */
    appropriate header file to pick up the TAU macros. */
 #include <TAU.h>
 #include <TAU.h>
+#include <Profile/Profiler.h>
 #else
 #else
 /* Otherwise, if we're not building with the Tau instrumentor, turn
 /* Otherwise, if we're not building with the Tau instrumentor, turn
    off all the TAU macros.  We could include the Tau header file to do
    off all the TAU macros.  We could include the Tau header file to do

+ 26 - 2
dtool/src/dtoolbase/dtoolbase_cc.h

@@ -16,12 +16,13 @@
 //
 //
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-#ifndef PANDABASE_CC_H
-#define PANDABASE_CC_H
+#ifndef DTOOLBASE_CC_H
+#define DTOOLBASE_CC_H
 
 
 // This file should never be included directly; it's intended to be
 // This file should never be included directly; it's intended to be
 // included only from dtoolbase.h.  Include that file instead.
 // included only from dtoolbase.h.  Include that file instead.
 
 
+#ifdef __cplusplus
 
 
 #ifdef CPPPARSER
 #ifdef CPPPARSER
 #include <iostream>
 #include <iostream>
@@ -182,7 +183,30 @@ INLINE void operator delete[](void *ptr) {
   (*global_operator_delete)(ptr);
   (*global_operator_delete)(ptr);
 }
 }
 
 
+#if defined(USE_TAU) && defined(WIN32)
+// Hack around tau's lack of DLL export declarations for Profiler class.
+class EXPCL_DTOOL TauProfile {
+public:
+  TauProfile(char *name, char *type, int group, char *group_name) {
+    _tautimer = NULL;
+    Tau_profile_c_timer(&_tautimer, name, type, group, group_name);
+    TAU_PROFILE_START(_tautimer); 
+  }
+  ~TauProfile() {
+    TAU_PROFILE_STOP(_tautimer);
+  }
+
+private:
+  void *_tautimer;
+};
+
+#undef TAU_PROFILE
+#define TAU_PROFILE(name, type, group) TauProfile _taupr(name, type, group, #group)
+#endif  // USE_TAU
+
 #endif  // GLOBAL_OPERATOR_NEW_EXCEPTIONS
 #endif  // GLOBAL_OPERATOR_NEW_EXCEPTIONS
 #endif  // USE_MEMORY_NOWRAPPERS
 #endif  // USE_MEMORY_NOWRAPPERS
 
 
+#endif  //  __cplusplus
+
 #endif
 #endif