]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/objectstore/Allocator_bench.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / test / objectstore / Allocator_bench.cc
index 71277bc807e9027e55b5545a34a922b3b5c498d9..0d04a854e9aa94cef7b3a8d1d14f1b3a17c37675 100644 (file)
@@ -21,6 +21,8 @@ typedef boost::mt11213b gen_type;
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_
 
+using namespace std;
+
 class AllocTest : public ::testing::TestWithParam<const char*> {
 
 public:
@@ -28,7 +30,7 @@ public:
   AllocTest(): alloc(0) { }
   void init_alloc(int64_t size, uint64_t min_alloc_size) {
     std::cout << "Creating alloc type " << string(GetParam()) << " \n";
-    alloc.reset(Allocator::create(g_ceph_context, string(GetParam()), size,
+    alloc.reset(Allocator::create(g_ceph_context, GetParam(), size,
                                  min_alloc_size));
   }
 
@@ -333,7 +335,7 @@ TEST_P(AllocTest, mempoolAccounting)
 
   uint64_t alloc_size = 4 * 1024;
   uint64_t capacity = 512ll * 1024 * 1024 * 1024;
-  Allocator* alloc = Allocator::create(g_ceph_context, string(GetParam()),
+  Allocator* alloc = Allocator::create(g_ceph_context, GetParam(),
                                       capacity, alloc_size);
   ASSERT_NE(alloc, nullptr);
   alloc->init_add_free(0, capacity);
@@ -343,8 +345,10 @@ TEST_P(AllocTest, mempoolAccounting)
     PExtentVector tmp;
     alloc->allocate(alloc_size, alloc_size, 0, 0, &tmp);
     all_allocs[rand()] = tmp;
+    tmp.clear();
     alloc->allocate(alloc_size, alloc_size, 0, 0, &tmp);
     all_allocs[rand()] = tmp;
+    tmp.clear();
 
     auto it = all_allocs.upper_bound(rand());
     if (it != all_allocs.end()) {
@@ -361,4 +365,4 @@ TEST_P(AllocTest, mempoolAccounting)
 INSTANTIATE_TEST_SUITE_P(
   Allocator,
   AllocTest,
-  ::testing::Values("stupid", "bitmap", "avl", "hybrid"));
+  ::testing::Values("stupid", "bitmap", "avl", "btree", "hybrid"));