Rename benchmark classes, hopefully less confusing to valgrid?
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 23 Apr 2014 21:03:45 +0000 (21:03 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 23 Apr 2014 21:03:45 +0000 (21:03 +0000)
I was able to reproduce the problem, but Valgrind was giving me a very odd
report, pointing to a particular line in QuadTreeBench.cpp from a stack that
was running RTreeBench.

Whenever Valgrind complains, it's always about switch(fQuery), line 109 in
QuadTreeBench or 119 in RTreeBench.  I can't see any way that fQuery is not
initialized.

I believe we've just confused Valgrind by linking together  classes with
identical names.  This CL gives them all unique names.

BUG=skia:2455
R=bungeman@google.com, mtklein@google.com, bsalomon@google.com, borenet@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/247913003

git-svn-id: http://skia.googlecode.com/svn/trunk@14338 2bbb7eff-a529-9590-31e7-b0007b416f81

bench/QuadTreeBench.cpp
bench/RTreeBench.cpp
bench/valgrind.supp

index 4204e91c0734d62d1a0f1b4ab89de7f6d390c39e..3846ada307c504a6ae7ed392b250039514f14a93 100644 (file)
@@ -22,9 +22,9 @@ static const SkIRect QUAD_TREE_BOUNDS = SkIRect::MakeLTRB(
 typedef SkIRect (*MakeRectProc)(SkRandom&, int, int);
 
 // Time how long it takes to build an QuadTree
-class BBoxBuildBench : public SkBenchmark {
+class QuadTreeBuildBench : public SkBenchmark {
 public:
-    BBoxBuildBench(const char* name, MakeRectProc proc, SkBBoxHierarchy* tree)
+    QuadTreeBuildBench(const char* name, MakeRectProc proc, SkBBoxHierarchy* tree)
         : fTree(tree)
         , fProc(proc) {
         fName.append("quadtree_");
@@ -36,7 +36,7 @@ public:
         return backend == kNonRendering_Backend;
     }
 
-    virtual ~BBoxBuildBench() {
+    virtual ~QuadTreeBuildBench() {
         fTree->unref();
     }
 protected:
@@ -61,7 +61,7 @@ private:
 };
 
 // Time how long it takes to perform queries on an QuadTree
-class BBoxQueryBench : public SkBenchmark {
+class QuadTreeQueryBench : public SkBenchmark {
 public:
     enum QueryType {
         kSmall_QueryType, // small queries
@@ -70,7 +70,7 @@ public:
         kFull_QueryType   // queries that cover everything
     };
 
-    BBoxQueryBench(const char* name, MakeRectProc proc,
+    QuadTreeQueryBench(const char* name, MakeRectProc proc,
                     QueryType q, SkBBoxHierarchy* tree)
         : fTree(tree)
         , fProc(proc)
@@ -84,7 +84,7 @@ public:
         return backend == kNonRendering_Backend;
     }
 
-    virtual ~BBoxQueryBench() {
+    virtual ~QuadTreeQueryBench() {
         fTree->unref();
     }
 protected:
@@ -179,38 +179,38 @@ static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects)
 ///////////////////////////////////////////////////////////////////////////////
 
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects,
+    return SkNEW_ARGS(QuadTreeBuildBench, ("XYordered", &make_XYordered_rects,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("XYordered", &make_XYordered_rects,
-                      BBoxQueryBench::kRandom_QueryType,
+    return SkNEW_ARGS(QuadTreeQueryBench, ("XYordered", &make_XYordered_rects,
+                      QuadTreeQueryBench::kRandom_QueryType,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects,
+    return SkNEW_ARGS(QuadTreeBuildBench, ("YXordered", &make_YXordered_rects,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("YXordered", &make_YXordered_rects,
-                      BBoxQueryBench::kRandom_QueryType,
+    return SkNEW_ARGS(QuadTreeQueryBench, ("YXordered", &make_YXordered_rects,
+                      QuadTreeQueryBench::kRandom_QueryType,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects,
+    return SkNEW_ARGS(QuadTreeBuildBench, ("random", &make_random_rects,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("random", &make_random_rects,
-                      BBoxQueryBench::kRandom_QueryType,
+    return SkNEW_ARGS(QuadTreeQueryBench, ("random", &make_random_rects,
+                      QuadTreeQueryBench::kRandom_QueryType,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("concentric", &make_concentric_rects_increasing,
+    return SkNEW_ARGS(QuadTreeBuildBench, ("concentric", &make_concentric_rects_increasing,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_increasing,
-                      BBoxQueryBench::kRandom_QueryType,
+    return SkNEW_ARGS(QuadTreeQueryBench, ("concentric", &make_concentric_rects_increasing,
+                      QuadTreeQueryBench::kRandom_QueryType,
                       SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS))));
 )
index b51cc4c6a90b4dc552e9e3fda499bdf4a33c7dee..d8e6347379920317e7c938b0fd8eeda7e8dc5f24 100644 (file)
@@ -21,9 +21,9 @@ static const int GRID_WIDTH = 100;
 typedef SkIRect (*MakeRectProc)(SkRandom&, int, int);
 
 // Time how long it takes to build an R-Tree either bulk-loaded or not
-class BBoxBuildBench : public SkBenchmark {
+class RTreeBuildBench : public SkBenchmark {
 public:
-    BBoxBuildBench(const char* name, MakeRectProc proc, bool bulkLoad,
+    RTreeBuildBench(const char* name, MakeRectProc proc, bool bulkLoad,
                     SkBBoxHierarchy* tree)
         : fTree(tree)
         , fProc(proc)
@@ -40,7 +40,7 @@ public:
         return backend == kNonRendering_Backend;
     }
 
-    virtual ~BBoxBuildBench() {
+    virtual ~RTreeBuildBench() {
         fTree->unref();
     }
 protected:
@@ -67,7 +67,7 @@ private:
 };
 
 // Time how long it takes to perform queries on an R-Tree, bulk-loaded or not
-class BBoxQueryBench : public SkBenchmark {
+class RTreeQueryBench : public SkBenchmark {
 public:
     enum QueryType {
         kSmall_QueryType, // small queries
@@ -76,7 +76,7 @@ public:
         kFull_QueryType   // queries that cover everything
     };
 
-    BBoxQueryBench(const char* name, MakeRectProc proc, bool bulkLoad,
+    RTreeQueryBench(const char* name, MakeRectProc proc, bool bulkLoad,
                     QueryType q, SkBBoxHierarchy* tree)
         : fTree(tree)
         , fProc(proc)
@@ -94,7 +94,7 @@ public:
         return backend == kNonRendering_Backend;
     }
 
-    virtual ~BBoxQueryBench() {
+    virtual ~RTreeQueryBench() {
         fTree->unref();
     }
 protected:
@@ -189,81 +189,81 @@ static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects)
 ///////////////////////////////////////////////////////////////////////////////
 
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, false,
+    return SkNEW_ARGS(RTreeBuildBench, ("XYordered", &make_XYordered_rects, false,
                       SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, true,
+    return SkNEW_ARGS(RTreeBuildBench, ("XYordered", &make_XYordered_rects, true,
                       SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)XYordered", &make_XYordered_rects, true,
+    return SkNEW_ARGS(RTreeBuildBench, ("(unsorted)XYordered", &make_XYordered_rects, true,
                       SkRTree::Create(5, 16, 1, false)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("XYordered", &make_XYordered_rects, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
+    return SkNEW_ARGS(RTreeQueryBench, ("XYordered", &make_XYordered_rects, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)XYordered", &make_XYordered_rects, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
+    return SkNEW_ARGS(RTreeQueryBench, ("(unsorted)XYordered", &make_XYordered_rects, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
 )
 
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects, false,
+    return SkNEW_ARGS(RTreeBuildBench, ("YXordered", &make_YXordered_rects, false,
                       SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects, true,
+    return SkNEW_ARGS(RTreeBuildBench, ("YXordered", &make_YXordered_rects, true,
                       SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)YXordered", &make_YXordered_rects, true,
+    return SkNEW_ARGS(RTreeBuildBench, ("(unsorted)YXordered", &make_YXordered_rects, true,
                       SkRTree::Create(5, 16, 1, false)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("YXordered", &make_YXordered_rects, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
+    return SkNEW_ARGS(RTreeQueryBench, ("YXordered", &make_YXordered_rects, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)YXordered", &make_YXordered_rects, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
+    return SkNEW_ARGS(RTreeQueryBench, ("(unsorted)YXordered", &make_YXordered_rects, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
 )
 
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects, false,
+    return SkNEW_ARGS(RTreeBuildBench, ("random", &make_random_rects, false,
                       SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects, true,
+    return SkNEW_ARGS(RTreeBuildBench, ("random", &make_random_rects, true,
                       SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)random", &make_random_rects, true,
+    return SkNEW_ARGS(RTreeBuildBench, ("(unsorted)random", &make_random_rects, true,
                       SkRTree::Create(5, 16, 1, false)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("random", &make_random_rects, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
+    return SkNEW_ARGS(RTreeQueryBench, ("random", &make_random_rects, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)random", &make_random_rects, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
+    return SkNEW_ARGS(RTreeQueryBench, ("(unsorted)random", &make_random_rects, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
 )
 
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("concentric",
+    return SkNEW_ARGS(RTreeBuildBench, ("concentric",
                       &make_concentric_rects_increasing, true, SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)concentric",
+    return SkNEW_ARGS(RTreeBuildBench, ("(unsorted)concentric",
                       &make_concentric_rects_increasing, true, SkRTree::Create(5, 16, 1, false)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_increasing, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
+    return SkNEW_ARGS(RTreeQueryBench, ("concentric", &make_concentric_rects_increasing, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
 )
 DEF_BENCH(
-    return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_rects_increasing, true,
-                      BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
+    return SkNEW_ARGS(RTreeQueryBench, ("(unsorted)concentric", &make_concentric_rects_increasing, true,
+                      RTreeQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
 )
index 05d8a79daf4deffb6df6b57465137f1490b8900d..e6b15b4fd48a54266319dad7270d42a852513164 100644 (file)
    fun:_Z9tool_mainiPPc
    fun:(below main)
 }
-{
-   rtree_(unsorted)* http://skbug.com/2455
-   Memcheck:Cond
-   fun:_ZN14BBoxQueryBench6onDrawEiP8SkCanvas
-   fun:_ZN11SkBenchmark4drawEiP8SkCanvas
-   fun:_Z9tool_mainiPPc
-   fun:main
-}
-{
-   rtree_(unsorted)* 2 http://skbug.com/2455
-   Memcheck:Cond
-   fun:_ZN14BBoxQueryBench6onDrawEiP8SkCanvas
-   fun:_Z9tool_mainiPPc
-   fun:(below main)
-}
-