Browse Source

build once more with the Tau profiler

David Rose 14 years ago
parent
commit
59ec701a26

+ 1 - 1
dtool/Config.pp

@@ -907,7 +907,7 @@
 #define TAU_MAKEFILE
 #define TAU_ROOT
 #define PDT_ROOT
-#define TAU_OPTS -optKeepFiles
+#define TAU_OPTS -optKeepFiles -optRevert
 #define TAU_CFLAGS -D_GNU_SOURCE
 #define USE_TAU
 

+ 5 - 4
dtool/pptempl/Depends.pp

@@ -84,8 +84,9 @@
     #set DEPENDABLE_HEADERS $[DEPENDABLE_HEADERS] $[filter %.h %.I %.T %_src.cxx,$[get_sources]] $[included_sources]
 
     // Now compute the source files.
-    #define c_sources $[filter %.c,$[get_sources]]
-    #define cxx_sources $[filter-out %_src.cxx,$[filter %.cxx %.mm %.cpp,$[get_sources]]]
+    #define c_sources $[filter-out %_src.c,$[filter %.c,$[get_sources]]]
+    #define mm_sources $[filter %.mm,$[get_sources]]
+    #define cxx_sources $[filter-out %_src.cxx,$[filter %.cxx %.cpp,$[get_sources]]]
     #define cxx_interrogate_sources
     #if $[PYTHON_MODULE_ONLY]
       #set cxx_interrogate_sources $[cxx_sources]
@@ -96,7 +97,7 @@
     #define lxx_sources $[filter %.lxx,$[get_sources]]
 
     // Define what the object files are.
-    #foreach file $[c_sources] $[cxx_sources] $[cxx_interrogate_sources] $[yxx_sources] $[lxx_sources]
+    #foreach file $[c_sources] $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources] $[yxx_sources] $[lxx_sources]
       #define $[file]_obj $[patsubst %.c %.cxx %.mm %.cpp %.yxx %.lxx,$[ODIR]/$[obj_prefix]%$[OBJ],$[notdir $[file]]]
       #push 1 $[file]_obj
     #end file
@@ -160,7 +161,7 @@
       #set cxx_interrogate_sources $[cxx_interrogate_sources] $[generated_file]
     #endif
 
-    #define compile_sources $[c_sources] $[cxx_sources] $[cxx_interrogate_sources]
+    #define compile_sources $[c_sources] $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources]
 
   #end metalib_target lib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target
 

+ 5 - 1
dtool/pptempl/Global.pp

@@ -83,6 +83,10 @@
   #define python_framework $[PYTHON_FRAMEWORK]
 #endif
 
+#if $[USE_TAU]
+  #define tau_ipath $[wildcard $[TAU_IPATH]]
+#endif
+
 #if $[HAVE_THREADS]
   #define threads_ipath $[wildcard $[THREADS_IPATH]]
   #define threads_lpath $[wildcard $[THREADS_LPATH]]
@@ -697,7 +701,7 @@
 // names only; the -I switch is not included here.
 #defun get_ipath
   // hack to add stl,python.  should be removed
-  #define alt_ipath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_ipath] $[python_ipath]]
+  #define alt_ipath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_ipath] $[python_ipath] $[tau_ipath]]
 
   #foreach package $[use_packages]
     #set alt_ipath $[alt_ipath] $[$[package]_ipath]

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

@@ -341,7 +341,7 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)]
   // various .obj files.
 
   #define sources \
-   $[patsubst %,$[%_obj],$[c_sources] $[cxx_sources]]
+   $[patsubst %,$[%_obj],$[c_sources] $[mm_sources] $[cxx_sources]]
   #define interrogate_sources \
    $[patsubst %,$[%_obj],$[cxx_interrogate_sources]]
   #define cc_ld $[or $[get_ld],$[CC]]
@@ -656,7 +656,7 @@ $[TAB] $[compile_c]
 
 // Rules to compile C++ files (static objects).
 
-#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
+#foreach file $[sort $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources]]
 #define target $[$[file]_obj]
 #define source $[file]
 #define ipath $[target_ipath]
@@ -697,7 +697,7 @@ $[TAB] $[compile_c]
 
 // Rules to compile C++ files (shared objects).
 
-#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
+#foreach file $[sort $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources]]
 #define target $[$[file]_obj]
 #define source $[file]
 #define ipath $[target_ipath]

+ 0 - 9
dtool/src/dtoolbase/cmath.I

@@ -12,15 +12,6 @@
 //
 ////////////////////////////////////////////////////////////////////
 
-#ifdef __APPLE__
-#ifndef isnan
-#define isnan(x) \
-  ((sizeof(x) == sizeof(double)) ? \
-    __isnand(x) : \
-   (sizeof(x) == sizeof(float)) ? __isnanf(x) : __isnan(x))
-#endif
-#endif
-
 #ifdef __INTEL_COMPILER
 // see float.h
 #define FPU_CONTROLWORD_WRITEMASK    0xFFFFF        // if you look at defn of _CW_DEFAULT, all settings fall within 0xFFFFF

+ 2 - 2
dtool/src/dtoolbase/deletedBufferChain.cxx

@@ -47,7 +47,7 @@ DeletedBufferChain(size_t buffer_size) {
 void *DeletedBufferChain::
 allocate(size_t size, TypeHandle type_handle) {
 #ifdef USE_DELETED_CHAIN
-  TAU_PROFILE("void *DeletedBufferChain::allocate(size_t, TypeHandle)", " ", TAU_USER);
+  //TAU_PROFILE("void *DeletedBufferChain::allocate(size_t, TypeHandle)", " ", TAU_USER);
   assert(size <= _buffer_size);
 
   ObjectNode *obj;
@@ -105,7 +105,7 @@ allocate(size_t size, TypeHandle type_handle) {
 void DeletedBufferChain::
 deallocate(void *ptr, TypeHandle type_handle) {
 #ifdef USE_DELETED_CHAIN
-  TAU_PROFILE("void DeletedBufferChain::deallocate(void *, TypeHandle)", " ", TAU_USER);
+  //TAU_PROFILE("void DeletedBufferChain::deallocate(void *, TypeHandle)", " ", TAU_USER);
   assert(ptr != (void *)NULL);
 
 #ifdef DO_MEMORY_USAGE

+ 5 - 0
dtool/src/dtoolbase/dtoolbase_cc.h

@@ -20,6 +20,11 @@
 
 #ifdef __cplusplus
 
+#ifdef USE_TAU
+// Tau provides this destructive version of stdbool.h that we must mask.
+#define __PDT_STDBOOL_H_
+#endif
+
 #ifdef CPPPARSER
 #include <iostream>
 #include <string>

+ 4 - 0
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -18,6 +18,10 @@
 #include <errno.h>
 #include <stdio.h>  // for perror
 
+#ifdef __APPLE__
+#include <sys/param.h>  // for realpath
+#endif  // __APPLE__
+
 #ifdef WIN32_VC
 // Windows requires this for getcwd().
 #include <direct.h>

+ 1 - 0
panda/src/collide/collisionBox.cxx

@@ -15,6 +15,7 @@
 #include "collisionBox.h"
 #include "collisionLine.h"
 #include "collisionRay.h"
+#include "collisionSphere.h"
 #include "collisionSegment.h"
 #include "collisionHandler.h"
 #include "collisionEntry.h"

+ 5 - 1
panda/src/collide/collisionHandlerGravity.cxx

@@ -184,7 +184,11 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod
     // Add only the one that we're impacting with:
     add_entry(highest);
   } else {
-    _current_colliding.insert(valid_entries.begin(), valid_entries.end());
+    // Add all of them.
+    pvector<PT(CollisionEntry)>::iterator vi;
+    for (vi = valid_entries.begin(); vi != valid_entries.end(); ++vi) {
+      add_entry(*vi);
+    }
   }
 
   

+ 1 - 1
panda/src/framework/Sources.pp

@@ -34,7 +34,7 @@
     config_framework.cxx config_framework.h \
     pandaFramework.cxx pandaFramework.I pandaFramework.h \
     windowFramework.cxx windowFramework.I windowFramework.h \
-    shuttle_controls.bam.c
+    rock_floor.rgb_src.c shuttle_controls.bam_src.c
 
   #define INSTALL_HEADERS \
     pandaFramework.I pandaFramework.h \

+ 0 - 0
panda/src/framework/rock_floor.rgb.c → panda/src/framework/rock_floor.rgb_src.c


+ 0 - 0
panda/src/framework/shuttle_controls.bam.c → panda/src/framework/shuttle_controls.bam_src.c


+ 3 - 3
panda/src/framework/windowFramework.cxx

@@ -58,12 +58,12 @@
 
 // This is generated data for the standard texture we apply to the
 // blue triangle.
-#include "rock_floor.rgb.c"
+#include "rock_floor.rgb_src.c"
 
 // This is generated data for shuttle_controls.bam, a bamified version
 // of shuttle_controls.egg (found in the models tree).  It's
-// compiled in shuttle_controls.bam.c.
-#include "shuttle_controls.bam.c"
+// compiled in shuttle_controls.bam_src.c.
+#include "shuttle_controls.bam_src.c"
 
 // This number is chosen arbitrarily to override any settings in model
 // files.

+ 1 - 0
panda/src/pgraph/Sources.pp

@@ -120,6 +120,7 @@
     antialiasAttrib.cxx \
     attribNodeRegistry.cxx \
     audioVolumeAttrib.cxx \
+    auxBitplaneAttrib.cxx \
     auxSceneData.cxx \
     bamFile.cxx \
     billboardEffect.cxx \

+ 1 - 1
panda/src/pipeline/conditionVarPosixImpl.cxx

@@ -26,7 +26,7 @@
 ////////////////////////////////////////////////////////////////////
 void ConditionVarPosixImpl::
 wait(double timeout) {
-  TAU_PROFILE("ConditionVarPosixImpl::wait()", " ", TAU_USER);
+  //TAU_PROFILE("ConditionVarPosixImpl::wait()", " ", TAU_USER);
 
   struct timeval now;
   gettimeofday(&now, NULL);

+ 1 - 1
panda/src/pipeline/threadPosixImpl.cxx

@@ -201,7 +201,7 @@ void *ThreadPosixImpl::
 root_func(void *data) {
   TAU_REGISTER_THREAD();
   {
-    TAU_PROFILE("void ThreadPosixImpl::root_func()", " ", TAU_USER);
+    //TAU_PROFILE("void ThreadPosixImpl::root_func()", " ", TAU_USER);
 
     ThreadPosixImpl *self = (ThreadPosixImpl *)data;
     int result = pthread_setspecific(_pt_ptr_index, self->_parent_obj);

+ 1 - 1
panda/src/pipeline/threadWin32Impl.cxx

@@ -156,7 +156,7 @@ DWORD ThreadWin32Impl::
 root_func(LPVOID data) {
   TAU_REGISTER_THREAD();
   {
-    TAU_PROFILE("void ThreadWin32Impl::root_func()", " ", TAU_USER);
+    //TAU_PROFILE("void ThreadWin32Impl::root_func()", " ", TAU_USER);
 
     ThreadWin32Impl *self = (ThreadWin32Impl *)data;
     BOOL result = TlsSetValue(_pt_ptr_index, self->_parent_obj);

+ 5 - 9
panda/src/testbed/test_map.cxx

@@ -127,19 +127,15 @@ test_performance() {
 
   MemoryUsage::freeze();
   MapType *m = new MapType;
-  if (MemoryUsage::has_cpp_size()) {
-    cerr << "Empty map uses " << MemoryUsage::get_current_cpp_size()
-         << " bytes.\n";
-  }
+  cerr << "Empty map uses " << MemoryUsage::get_current_cpp_size()
+       << " bytes.\n";
 
   for (int p = 0; p < initial_population; p++) {
     m->insert(MapType::value_type(samples[rand() & sample_mask], 0));
   }
-  if (MemoryUsage::has_cpp_size()) {
-    cerr << "map with " << m->size() 
-         << " elements uses " << MemoryUsage::get_current_cpp_size()
-         << " bytes.\n";
-  }
+  cerr << "map with " << m->size() 
+       << " elements uses " << MemoryUsage::get_current_cpp_size()
+       << " bytes.\n";
 
   for (int r = 0; r < num_reps; r++) {
     double now = clock->get_real_time();

+ 12 - 28
panda/src/testbed/test_texmem.cxx

@@ -13,8 +13,9 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "pandaFramework.h"
-#include "geomQuad.h"
-#include "textureAttrib.h"
+#include "cardMaker.h"
+#include "texture.h"
+#include "pnmImage.h"
 #include "cmath.h"
 #include "mathNumbers.h"
 
@@ -22,12 +23,10 @@ NodePath bogus_scene;
 NodePath old_bogus_scene;
 
 void
-event_T(CPT_Event, void *data) {
+event_T(const Event *, void *data) {
   PandaFramework *framework = (PandaFramework *)data;
   WindowFramework *wf = framework->get_window(0);
 
-  GraphicsStateGuardian *gsg = wf->get_graphics_window()->get_gsg();
-  Camera *camera = wf->get_camera(0);
   NodePath models = framework->get_models();
   NodePath render = wf->get_render();
 
@@ -54,14 +53,9 @@ event_T(CPT_Event, void *data) {
   cerr << "Loading " << num_quads_side * num_quads_side << " textures at " 
        << tex_x_size << ", " << tex_y_size << "\n";
 
-  GeomNode *gnode = new GeomNode("quads");
-  bogus_scene.attach_new_node(gnode);
-
   PNMImage white_center(tex_x_size / 4, tex_y_size / 4);
   white_center.fill(1.0f, 1.0f, 1.0f);
 
-  PTA_Colorf colors;
-  colors.push_back(Colorf(1.0f, 1.0f, 1.0f, 1.0f));
   for (int yi = 0; yi < num_quads_side; yi++) {
     float y0 = (float)yi / (float)num_quads_side;
     float y1 = (float)(yi + 1) / (float)num_quads_side;
@@ -90,23 +84,13 @@ event_T(CPT_Event, void *data) {
       tex->set_minfilter(Texture::FT_linear_mipmap_linear);
       tex->load(bogus_image);
 
-      PTA_Vertexf coords;
-      PTA_TexCoordf uvs;
-      coords.push_back(Vertexf(hx0 * px0, hy0 * px0, py0));
-      coords.push_back(Vertexf(hx1 * px0, hy1 * px0, py0));
-      coords.push_back(Vertexf(hx1 * px1, hy1 * px1, py1));
-      coords.push_back(Vertexf(hx0 * px1, hy0 * px1, py1));
-      uvs.push_back(TexCoordf(0.0f, 0.0f));
-      uvs.push_back(TexCoordf(1.0f, 0.0f));
-      uvs.push_back(TexCoordf(1.0f, 1.0f));
-      uvs.push_back(TexCoordf(0.0f, 1.0f));
-      
-      PT(GeomQuad) quad = new GeomQuad;
-      quad->set_coords(coords);
-      quad->set_colors(colors, G_OVERALL);
-      quad->set_num_prims(1);
-      quad->set_texcoords(uvs, G_PER_VERTEX);
-      gnode->add_geom(quad, RenderState::make(TextureAttrib::make(tex)));
+      CardMaker cm("card");
+      cm.set_frame(Vertexf(hx0 * px0, hy0 * px0, py0),
+                   Vertexf(hx1 * px0, hy1 * px0, py0),
+                   Vertexf(hx1 * px1, hy1 * px1, py1),
+                   Vertexf(hx0 * px1, hy0 * px1, py1));
+      NodePath card = bogus_scene.attach_new_node(cm.generate());
+      card.set_texture(tex);
     }
   }
   cerr << "Done.\n";
@@ -134,7 +118,7 @@ main(int argc, char *argv[]) {
     window->loop_animations();
 
     framework.enable_default_keys();
-    framework.get_event_handler().add_hook("shift-t", event_T, &framework);
+    framework.define_key("shift-t", "test texture memory", event_T, &framework);
     framework.main_loop();
   }
 

+ 1 - 1
panda/src/text/Sources.pp

@@ -44,7 +44,7 @@
     textNode.cxx \
     textProperties.cxx \
     textPropertiesManager.cxx \
-    cmss12.bam.c cmss12.bam.pz.c persans.ttf.c
+    cmss12.bam_src.c cmss12.bam.pz_src.c persans.ttf_src.c
 
   #define INSTALL_HEADERS \
     config_text.h \

+ 0 - 0
panda/src/text/cmss12.bam.pz.c → panda/src/text/cmss12.bam.pz_src.c


+ 0 - 0
panda/src/text/cmss12.bam.c → panda/src/text/cmss12.bam_src.c


+ 5 - 5
panda/src/text/default_font.cxx

@@ -39,7 +39,7 @@
 
 // If we have FreeType available, include the ttf font; it's superior
 // because it's dynamic.  See above.
-#include "persans.ttf.c"
+#include "persans.ttf_src.c"
 
 #elif defined(HAVE_ZLIB)
 
@@ -50,9 +50,9 @@
 
 // egg2bam -rawtex -o cmss12.bam cmss12.egg
 // pzip cmss12.bam
-// bin2c -n default_font_data -o cmss12.bam.pz.c cmss12.bam.pz
+// bin2c -n default_font_data -o cmss12.bam.pz_src.c cmss12.bam.pz
 
-#include "cmss12.bam.pz.c"
+#include "cmss12.bam.pz_src.c"
 
 #else
 
@@ -62,9 +62,9 @@
 // Regenerate this file with (cmss12.egg can be loaded from the models tree):
 
 // egg2bam -rawtex -o cmss12.bam cmss12.egg
-// bin2c -n default_font_data -o cmss12.bam.c cmss12.bam
+// bin2c -n default_font_data -o cmss12.bam_src.c cmss12.bam
 
-#include "cmss12.bam.c"
+#include "cmss12.bam_src.c"
 
 #endif
 

+ 0 - 0
panda/src/text/persans.ttf.c → panda/src/text/persans.ttf_src.c