Remove dependency of boost/glib to the pool benchmark
This commit is contained in:
1 parent
54fa2c8635
commit
170ed98701
2 files changed
+18
-3
No files matched your search
+3
-1
@@ -271,7 +271,9 @@ bench-plain:
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
bench-mempool:
|
bench-mempool:
|
||||||
$(CXX) $(CFLAGS) $(CPPFLAGS) pool.cc `pkg-config --libs --cflags glib-2.0` -lboost_system -o bench-mempool.exe
|
@if test -n "$${BOOST}" ; then if test -n "$${GLIB}" ; then make bench-mempool0 BENCH_DEF="-DUSE_BOOST -DUSE_GLIB `pkg-config --libs --cflags glib-2.0` -lboost_system" ; else make bench-mempool0 BENCH_DEF="-DUSE_BOOST -lboost_system" ; fi ; else if test -n "$${GLIB}" ; then make bench-mempool0 BENCH_DEF="-DUSE_GLIB `pkg-config --libs --cflags glib-2.0`" ; else make bench-mempool0 ; fi ; fi
|
||||||
|
bench-mempool0:
|
||||||
|
$(CXX) $(CFLAGS) $(CPPFLAGS) pool.cc $(BENCH_DEF) -o bench-mempool.exe
|
||||||
@./bench-mempool.exe
|
@./bench-mempool.exe
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|||||||
+15
-2
@@ -51,9 +51,13 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#ifdef USE_BOOST
|
||||||
#include <boost/pool/object_pool.hpp>
|
#include <boost/pool/object_pool.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_GLIB
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static const size_t PAGE_SIZE = 4096;
|
static const size_t PAGE_SIZE = 4096;
|
||||||
|
|
||||||
@@ -115,6 +119,8 @@ benchmark(std::string &&desc, std::function<void ()> cb)
|
|||||||
* Boost::pool
|
* Boost::pool
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#ifdef USE_BOOST
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void
|
||||||
benchmark_boost_pool()
|
benchmark_boost_pool()
|
||||||
@@ -166,6 +172,7 @@ benchmark_boost_pool_create_and_destroy()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
@@ -220,6 +227,7 @@ benchmark_mallocfree_free()
|
|||||||
* GLib slices
|
* GLib slices
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#ifdef USE_GLIB
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void
|
||||||
benchmark_glib_slices()
|
benchmark_glib_slices()
|
||||||
@@ -262,6 +270,7 @@ benchmark_glib_slices_free()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
@@ -892,19 +901,23 @@ main()
|
|||||||
benchmark_mallocfree_free<Big>();
|
benchmark_mallocfree_free<Big>();
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
#ifdef USE_GLIB
|
||||||
benchmark_glib_slices<Small>();
|
benchmark_glib_slices<Small>();
|
||||||
benchmark_glib_slices_free<Small>();
|
benchmark_glib_slices_free<Small>();
|
||||||
benchmark_glib_slices<Big>();
|
benchmark_glib_slices<Big>();
|
||||||
benchmark_glib_slices_free<Big>();
|
benchmark_glib_slices_free<Big>();
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_BOOST
|
||||||
benchmark_boost_pool<Small>();
|
benchmark_boost_pool<Small>();
|
||||||
benchmark_boost_pool_free<Small>();
|
benchmark_boost_pool_free<Small>();
|
||||||
benchmark_boost_pool<Big>();
|
benchmark_boost_pool<Big>();
|
||||||
benchmark_boost_pool_free<Big>();
|
benchmark_boost_pool_free<Big>();
|
||||||
benchmark_boost_pool_create_and_destroy();
|
benchmark_boost_pool_create_and_destroy();
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
benchmark_ngx_pool<Small>();
|
benchmark_ngx_pool<Small>();
|
||||||
benchmark_ngx_pool<Big>();
|
benchmark_ngx_pool<Big>();
|
||||||
benchmark_ngx_pool_mix_free();
|
benchmark_ngx_pool_mix_free();
|
||||||
|
|||||||
Reference in new issue
Block a user