Browse Source

tau for windows

David Rose 19 years ago
parent
commit
d2e1cb779d

+ 6 - 0
dtool/Config.Win32.pp

@@ -10,6 +10,9 @@
 // NSPR versions prior to 4.4 used _declspec instead of __declspec.
 // NSPR versions prior to 4.4 used _declspec instead of __declspec.
 #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.
+#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
+
 // 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
 // indicate little-endian, or nonempty to indicate big-endian.
 // indicate little-endian, or nonempty to indicate big-endian.
@@ -134,6 +137,9 @@
 // Must global operator new and delete functions throw exceptions?
 // Must global operator new and delete functions throw exceptions?
 #define GLOBAL_OPERATOR_NEW_EXCEPTIONS
 #define GLOBAL_OPERATOR_NEW_EXCEPTIONS
 
 
+// MSVC7 does support the latest STL allocator definitions.
+#define USE_STL_ALLOCATOR 1
+
 // can Intel C++ build this directory successfully (if not, change CC to msvc)
 // can Intel C++ build this directory successfully (if not, change CC to msvc)
 #define NOT_INTEL_BUILDABLE false
 #define NOT_INTEL_BUILDABLE false
 
 

+ 1 - 1
dtool/Config.pp

@@ -645,7 +645,7 @@
 // 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,
 // To use it, define TAU_MAKEFILE appropriately, define USE_TAU to 1,
 // and rebuild the code with ppremake; make install.
 // and rebuild the code with ppremake; make install.
-#define TAU_MAKEFILE /usr/local/tau/i386_linux/lib/Makefile.tau-pthread-pdt
+#define TAU_MAKEFILE
 #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

+ 18 - 4
dtool/pptempl/Global.gmsvc.pp

@@ -80,6 +80,8 @@
 #defer CDEFINES_OPT3 $[dlink_all_static] $[EXTRA_CDEFS]
 #defer CDEFINES_OPT3 $[dlink_all_static] $[EXTRA_CDEFS]
 #defer CDEFINES_OPT4 NDEBUG $[dlink_all_static] $[EXTRA_CDEFS]
 #defer CDEFINES_OPT4 NDEBUG $[dlink_all_static] $[EXTRA_CDEFS]
 
 
+#defer cdefines $[CDEFINES_OPT$[OPTIMIZE]]
+
 //  Opt1 /GZ disables OPT flags, so make sure its OPT1 only
 //  Opt1 /GZ disables OPT flags, so make sure its OPT1 only
 #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPT1FLAGS]
 #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPT1FLAGS]
 #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPTFLAGS]
 #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPTFLAGS]
@@ -121,8 +123,20 @@
 // the defining extra_cflags in individual sources.pp's will not picked up.  use END_FLAGS instead
 // the defining extra_cflags in individual sources.pp's will not picked up.  use END_FLAGS instead
 #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]
 
 
-#defer DECYGWINED_INC_PATHLIST_ARGS $[decygwin %,/I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH]]
-#defer MAIN_C_COMPILE_ARGS /nologo /c $[DECYGWINED_INC_PATHLIST_ARGS] $[flags] $[extra_cflags] "$[osfilename $[source]]"
+#if $[direct_tau]
+#define tau_ipath $[ROOT_TAU]/include
+#define tau_cflags /DPROFILING_ON /DTAU_STDCXXLIB
+#define tau_lpath $[ROOT_TAU]/lib/VC7
+#define tau_libs tau-profile-static-mt.lib
+#else  // direct_tau
+#define tau_ipath
+#define tau_cflags
+#define tau_lpath
+#define tau_libs
+#endif   // direct_tau
+
+#defer DECYGWINED_INC_PATHLIST_ARGS $[decygwin %,/I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]]
+#defer MAIN_C_COMPILE_ARGS /nologo /c $[DECYGWINED_INC_PATHLIST_ARGS] $[flags] $[extra_cflags] $[tau_cflags] "$[osfilename $[source]]"
 
 
 #defer COMPILE_C $[COMPILER] /Fo"$[osfilename $[target]]" $[MAIN_C_COMPILE_ARGS]
 #defer COMPILE_C $[COMPILER] /Fo"$[osfilename $[target]]" $[MAIN_C_COMPILE_ARGS]
 #defer COMPILE_C++ $[COMPILE_C]
 #defer COMPILE_C++ $[COMPILE_C]
@@ -148,10 +162,10 @@
 
 
 //#defer ver_resource $[directory]\ver.res
 //#defer ver_resource $[directory]\ver.res
 //#defer SHARED_LIB_C link /nologo /dll /VERBOSE:LIB $[LDFLAGS_OPT$[OPTIMIZE]] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]]
 //#defer SHARED_LIB_C link /nologo /dll /VERBOSE:LIB $[LDFLAGS_OPT$[OPTIMIZE]] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]]
-#defer SHARED_LIB_C $[LINKER] /nologo /DLL $[LINKER_DEF_FILE_ARG] $[LDFLAGS_OPT$[OPTIMIZE]] $[DLLBASEARG] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]]
+#defer SHARED_LIB_C $[LINKER] /nologo /DLL $[LINKER_DEF_FILE_ARG] $[LDFLAGS_OPT$[OPTIMIZE]] $[DLLBASEARG] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs]
 #defer SHARED_LIB_C++ $[SHARED_LIB_C]
 #defer SHARED_LIB_C++ $[SHARED_LIB_C]
 
 
-#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
+#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs] /OUT:"$[osfilename $[target]]"
 #defer LINK_BIN_C++ $[LINK_BIN_C]
 #defer LINK_BIN_C++ $[LINK_BIN_C]
 
 
 #if $[ne $[LINK_ALL_STATIC],]
 #if $[ne $[LINK_ALL_STATIC],]

+ 6 - 1
dtool/pptempl/Global.pp

@@ -331,7 +331,12 @@
 // the target is not to be built.
 // the target is not to be built.
 #defer build_target $[BUILD_TARGET]
 #defer build_target $[BUILD_TARGET]
 
 
-#if $[USE_TAU]
+// If we have USE_TAU but not TAU_MAKEFILE, we invoke the tau
+// instrumentor and compiler directly.
+#define direct_tau $[and $[USE_TAU],$[not $[TAU_MAKEFILE]]]
+
+#if $[and $[USE_TAU],$[TAU_MAKEFILE]]
+  // Use the makefile-based rules to run the tau instrumentor.
 #defer compile_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C] $[TAU_CFLAGS]
 #defer compile_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C] $[TAU_CFLAGS]
 #defer compile_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
 #defer compile_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
 #defer link_bin_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C] $[TAU_CFLAGS]
 #defer link_bin_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C] $[TAU_CFLAGS]

+ 56 - 10
dtool/pptempl/Template.gmsvc.pp

@@ -234,6 +234,9 @@ $[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cx
 #if $[py_sources]
 #if $[py_sources]
 $[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code.
 $[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code.
 #endif
 #endif
+#if $[USE_TAU]
+$[TAB] rm -f *.il *.pdb *.inst.*  // scrub out tau-generated files.
+#endif
 
 
 // 'cleanall' is intended to undo all the effects of running ppremake
 // 'cleanall' is intended to undo all the effects of running ppremake
 // and building.  It removes everything except the Makefile.
 // and building.  It removes everything except the Makefile.
@@ -380,16 +383,16 @@ $[TAB]  mkdir -p $[tmpdirname_cyg]  // this dir-creation-stuff is leftover from
 $[TAB]  cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp"  > "$[tmpdirname_win]\verdate.h"
 $[TAB]  cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp"  > "$[tmpdirname_win]\verdate.h"
 $[TAB]  rc /n /I"$[tmpdirname_win]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[VER_RESOURCE] $[filter /D%, $[flags]]  "$[dtool_ver_dir]\version.rc"
 $[TAB]  rc /n /I"$[tmpdirname_win]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[VER_RESOURCE] $[filter /D%, $[flags]]  "$[dtool_ver_dir]\version.rc"
   #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
   #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
-$[TAB] $[SHARED_LIB_C++] $[VER_RESOURCE]
+$[TAB] $[shared_lib_c++] $[VER_RESOURCE]
   #else
   #else
-$[TAB] $[SHARED_LIB_C] $[VER_RESOURCE]
+$[TAB] $[shared_lib_c] $[VER_RESOURCE]
   #endif
   #endif
 #else
 #else
 .NOTPARALLEL $[target] : $[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%]
 .NOTPARALLEL $[target] : $[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%]
   #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
   #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
-$[TAB] $[SHARED_LIB_C++]
+$[TAB] $[shared_lib_c++]
   #else
   #else
-$[TAB] $[SHARED_LIB_C]
+$[TAB] $[shared_lib_c]
   #endif
   #endif
 #endif
 #endif
 
 
@@ -506,9 +509,9 @@ $[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
 #define sources $($[varname])
 #define sources $($[varname])
 $[target] : $[sources] $[static_lib_dependencies] $[GENERATED_SOURCES]
 $[target] : $[sources] $[static_lib_dependencies] $[GENERATED_SOURCES]
 #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
 #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
-$[TAB] $[SHARED_LIB_C++] $[COMPILED_RESOURCES]
+$[TAB] $[shared_lib_c++] $[COMPILED_RESOURCES]
 #else
 #else
-$[TAB] $[SHARED_LIB_C] $[COMPILED_RESOURCES]
+$[TAB] $[shared_lib_c] $[COMPILED_RESOURCES]
 #endif
 #endif
 
 
 #if $[build_dlls]
 #if $[build_dlls]
@@ -670,9 +673,9 @@ $[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
 #else
 #else
   // Otherwise, we can use the normal linker.
   // Otherwise, we can use the normal linker.
   #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
   #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
-$[TAB] $[LINK_BIN_C++]
+$[TAB] $[link_bin_c++]
   #else
   #else
-$[TAB] $[LINK_BIN_C]
+$[TAB] $[link_bin_c]
   #endif
   #endif
 #endif
 #endif
 
 
@@ -736,9 +739,9 @@ $[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
 #define sources $($[varname])
 #define sources $($[varname])
 $[target] : $[sources] $[static_lib_dependencies]
 $[target] : $[sources] $[static_lib_dependencies]
 #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
 #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
-$[TAB] $[LINK_BIN_C++]
+$[TAB] $[link_bin_c++]
 #else
 #else
-$[TAB] $[LINK_BIN_C]
+$[TAB] $[link_bin_c]
 #endif
 #endif
 
 
 #end noinst_bin_target test_bin_target test_lib_target
 #end noinst_bin_target test_bin_target test_lib_target
@@ -817,9 +820,31 @@ $[TAB] cp $[target_prebuilt] $[target]
   #set ipath . $[ipath]
   #set ipath . $[ipath]
 #endif
 #endif
 
 
+#if $[not $[direct_tau]]
+
 $[target] : $[source] $[get_depends $[source]]
 $[target] : $[source] $[get_depends $[source]]
+$[TAB] $[compile_c]
+
+#else  // direct_tau
+// This version is used to invoke the tau compiler directly.
+#define il_source $[source].il
+#define pdb_source $[source].pdb  // Not to be confused with windows .pdb debugger info files.
+#define inst_source $[source:%.c=%.inst.c]
+$[il_source] : $[source]
+$[TAB] $[TAU_MAKE_IL]
+
+$[pdb_source] : $[il_source]
+$[TAB] $[TAU_MAKE_PDB]
+
+$[inst_source] : $[pdb_source]
+$[TAB] $[TAU_MAKE_INST] -c
+
+$[target] : $[inst_source] $[get_depends $[source]]
+#define source $[inst_source]
 $[TAB] $[COMPILE_C]
 $[TAB] $[COMPILE_C]
 
 
+#endif  // direct_tau
+
 #end file
 #end file
 
 
 // Rules to compile C++ files.
 // Rules to compile C++ files.
@@ -835,11 +860,32 @@ $[TAB] $[COMPILE_C]
   #set ipath . $[ipath]
   #set ipath . $[ipath]
 #endif
 #endif
 
 
+#if $[not $[direct_tau]]
 // Yacc must run before some files can be compiled, so all files
 // Yacc must run before some files can be compiled, so all files
 // depend on yacc having run.
 // depend on yacc having run.
 $[target] : $[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h]
 $[target] : $[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h]
+$[TAB] $[compile_c++]
+
+#else  // direct_tau
+// This version is used to invoke the tau compiler directly.
+#define il_source $[source].il
+#define pdb_source $[source].pdb  // Not to be confused with windows .pdb debugger info files.
+#define inst_source $[source:%.cxx=%.inst.cxx]
+$[il_source] : $[source] $[yxx_sources:%.yxx=%.h]
+$[TAB] $[TAU_MAKE_IL]
+
+$[pdb_source] : $[il_source]
+$[TAB] $[TAU_MAKE_PDB]
+
+$[inst_source] : $[pdb_source]
+$[TAB] $[TAU_MAKE_INST] -c++
+
+$[target] : $[inst_source] $[get_depends $[source]]
+#define source $[inst_source]
 $[TAB] $[COMPILE_C++]
 $[TAB] $[COMPILE_C++]
 
 
+#endif  // direct_tau
+
 #end file
 #end file
 
 
 #end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target
 #end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target

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

@@ -178,7 +178,7 @@
 #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
 #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
 ################################# DO NOT EDIT ###########################
 ################################# DO NOT EDIT ###########################
 
 
-#if $[USE_TAU]
+#if $[and $[USE_TAU],$[TAU_MAKEFILE]]
 include $[TAU_MAKEFILE]
 include $[TAU_MAKEFILE]
 #endif
 #endif
 
 

+ 4 - 11
dtool/pptempl/compilerSettings.pp

@@ -47,23 +47,12 @@
   // ensure pdbs are copied to install dir
   // ensure pdbs are copied to install dir
   #define build_pdbs yes
   #define build_pdbs yes
 
 
-  #define STL_ALLOCATOR VC6
-
 #elif $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]]
 #elif $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]]
 
 
   #define COMPILER cl
   #define COMPILER cl
   #define LINKER link
   #define LINKER link
   #define LIBBER lib
   #define LIBBER lib
 
 
-  #if $[eq $[USE_COMPILER], MSVC7]
-    // What is the syntax of the STL allocator declaration?  See
-    // LocalSetup.pp for allowable values.
-    #define STL_ALLOCATOR MODERN
-  #else
-    // until I figure out how to get rid of 'rebind' vc7.1 C4346 build errors
-    #define STL_ALLOCATOR UNKNOWN
-  #endif
-
   #if $[eq $[NO_CROSSOBJ_OPT],]
   #if $[eq $[NO_CROSSOBJ_OPT],]
      #define DO_CROSSOBJ_OPT 1
      #define DO_CROSSOBJ_OPT 1
   #endif
   #endif
@@ -234,3 +223,7 @@
 #define END_CFLAGS $[END_CFLAGS] /E
 #define END_CFLAGS $[END_CFLAGS] /E
 #endif
 #endif
 
 
+#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]

+ 0 - 8
dtool/src/dtoolbase/pvector.h

@@ -49,14 +49,6 @@ public:
   pvector(size_type n) : base_class(n) { }
   pvector(size_type n) : base_class(n) { }
   pvector(size_type n, const Type &value) : base_class(n, value) { }
   pvector(size_type n, const Type &value) : base_class(n, value) { }
   pvector(const Type *begin, const Type *end) : base_class(begin, end) { }
   pvector(const Type *begin, const Type *end) : base_class(begin, end) { }
-
-#ifdef USE_TAU
-  void
-  push_back(const TYPENAME base_class::value_type &x) {
-    TAU_PROFILE("pvector::push_back(const value_type &)", " ", TAU_USER);
-    base_class::push_back(x);
-  }
-#endif  // USE_TAU
 };
 };
 
 
 #endif  // USE_STL_ALLOCATOR
 #endif  // USE_STL_ALLOCATOR