[Bf-extensions-cvs] [7acd00d] master: Moved profiling code up one level.

Lukas Tönne noreply at git.blender.org
Sat Dec 13 14:46:51 CET 2014


Commit: 7acd00d6af7ada17e6280d8a559b379dd799b525
Author: Lukas Tönne
Date:   Sat Dec 13 14:46:32 2014 +0100
Branches: master
https://developer.blender.org/rBAC7acd00d6af7ada17e6280d8a559b379dd799b525

Moved profiling code up one level.

===================================================================

M	object_physics_meadow/meadow.py

===================================================================

diff --git a/object_physics_meadow/meadow.py b/object_physics_meadow/meadow.py
index 35a5684..e5013d7 100644
--- a/object_physics_meadow/meadow.py
+++ b/object_physics_meadow/meadow.py
@@ -47,28 +47,29 @@ def make_samples(context, gridob, groundob):
     gen = hierarchical_dart_throw_gen(groundob.meadow.patch_radius, groundob.meadow.sampling_levels, xmin, xmax, ymin, ymax)
     
     mat = groundob.matrix_world
+    loc2D = [(mat * Vector(p[0:3] + (1.0,)))[0:2] for p in gen(groundob.meadow.seed, groundob.meadow.max_patches)]
+    
+    return loc2D
+
+### Duplicators for later instancing ###
+def make_blobs(context, gridob, groundob):
+    # patches are linked to current blobs, clear to avoid confusing reset
+    patch.patch_group_clear(context)
+    
     if use_profiling:
         prof = cProfile.Profile()
         prof.enable()
-        loc2D = [(mat * Vector(p[0:3] + (1.0,)))[0:2] for p in gen(groundob.meadow.seed, groundob.meadow.max_patches)]
+        samples2D = make_samples(context, gridob, groundob)
+        blob.make_blobs(context, gridob, groundob, samples2D, groundob.meadow.patch_radius)
         prof.disable()
 
         s = io.StringIO()
-        ps = pstats.Stats(prof, stream=s).sort_stats('cumulative')
+        ps = pstats.Stats(prof, stream=s).sort_stats('tottime')
         ps.print_stats()
         print(s.getvalue())
     else:
-        loc2D = [(mat * Vector(p[0:3] + (1.0,)))[0:2] for p in gen(groundob.meadow.seed, groundob.meadow.max_patches)]
-    
-    return loc2D
-
-### Duplicators for later instancing ###
-def make_blobs(context, gridob, groundob):
-    # patches are linked to current blobs, clear to avoid confusing reset
-    patch.patch_group_clear(context)
-    
-    samples2D = make_samples(context, gridob, groundob)
-    blob.make_blobs(context, gridob, groundob, samples2D, groundob.meadow.patch_radius)
+        samples2D = make_samples(context, gridob, groundob)
+        blob.make_blobs(context, gridob, groundob, samples2D, groundob.meadow.patch_radius)
 
 ### Patch copies for simulation ###
 def make_patches(context, gridob, groundob):



More information about the Bf-extensions-cvs mailing list