From 1d7d66a1def4198a3bc569f04d97ecdf93922402 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Fri, 10 Jan 2014 19:14:01 +0000 Subject: [PATCH] Add some (commented-out) logging for timings --- .../DualContouringSurfaceExtractor.inl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl index 4799ef66..a35ffaef 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl @@ -156,7 +156,8 @@ namespace PolyVox template SurfaceMesh dualContouringSurfaceExtractor(VolumeType* volData, Region region) { - Timer timer; + //Timer timer; + Timer totalTimer; const auto regionXDimension = region.getDimensionsInVoxels().getX(); const auto regionYDimension = region.getDimensionsInVoxels().getY(); @@ -190,6 +191,9 @@ namespace PolyVox const auto lowerCornerY = region.getLowerCorner().getZ(); const auto lowerCornerZ = region.getLowerCorner().getX(); + //logTrace() << "Setup took " << timer.elapsedTimeInMilliSeconds(); + //timer.start(); + for(int32_t z = 0; z < gradientRegionZDimension; z++) { volSampler.setPosition(lowerCornerX-1, lowerCornerY-1, lowerCornerZ+z-1); //Reset x and y and increment z @@ -217,6 +221,9 @@ namespace PolyVox } } + //logTrace() << "Gradients took " << timer.elapsedTimeInMilliSeconds(); + //timer.start(); + for(int32_t cellZ = 0; cellZ < cellRegionZDimension; cellZ++) { for(int32_t cellY = 0; cellY < cellRegionYDimension; cellY++) @@ -257,6 +264,9 @@ namespace PolyVox } } + //logTrace() << "Edges took " << timer.elapsedTimeInMilliSeconds(); + //timer.start(); + for(int32_t cellZ = 0; cellZ < cellRegionZDimension; cellZ++) { for(int32_t cellY = 0; cellY < cellRegionYDimension; cellY++) @@ -335,11 +345,12 @@ namespace PolyVox } } - //logTrace() << "Dual contouring surface extraction took " << timer.elapsedTimeInMilliSeconds() << "ms (Region size = " << region.getWidthInVoxels() << "x" << region.getHeightInVoxels() << "x" << region.getDepthInVoxels() << ")"; + //logTrace() << "Vertices and quads took " << timer.elapsedTimeInMilliSeconds(); + //timer.start(); - logTrace() << "Dual contouring surface extraction took " << timer.elapsedTimeInMilliSeconds() << "ms (Region size = " << region.getWidthInVoxels() << "x" << region.getHeightInVoxels() << "x" << region.getDepthInVoxels() << ")"; + logTrace() << "Dual contouring surface extraction took " << totalTimer.elapsedTimeInMilliSeconds() << "ms (Region size = " << region.getWidthInVoxels() << "x" << region.getHeightInVoxels() << "x" << region.getDepthInVoxels() << ")"; - std::cout << mesh.getNoOfVertices() << std::endl; + logTrace() << mesh.getNoOfVertices(); return mesh; }