mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-10 04:50:31 -04:00
feat: list jemalloc dependency
This commit is contained in:
parent
f2afdfb4df
commit
b3bdf94fc2
@ -27,6 +27,10 @@
|
|||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <xxhash.h>
|
#include <xxhash.h>
|
||||||
|
|
||||||
|
#ifdef DWARFS_USE_JEMALLOC
|
||||||
|
#include <jemalloc/jemalloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dwarfs/block_compressor.h"
|
#include "dwarfs/block_compressor.h"
|
||||||
#include "dwarfs/library_dependencies.h"
|
#include "dwarfs/library_dependencies.h"
|
||||||
|
|
||||||
@ -47,6 +51,19 @@ std::string version_to_string(uint64_t version, version_format fmt) {
|
|||||||
throw std::invalid_argument("unsupported version format");
|
throw std::invalid_argument("unsupported version format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DWARFS_USE_JEMALLOC
|
||||||
|
std::string get_jemalloc_version() {
|
||||||
|
const char* j;
|
||||||
|
size_t s = sizeof(j);
|
||||||
|
::mallctl("version", &j, &s, nullptr, 0);
|
||||||
|
std::string rv{j};
|
||||||
|
if (auto pos = rv.find('-'); pos != std::string::npos) {
|
||||||
|
rv.erase(pos, std::string::npos);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::string library_dependencies::common_as_string() {
|
std::string library_dependencies::common_as_string() {
|
||||||
@ -88,6 +105,10 @@ void library_dependencies::add_common_libraries() {
|
|||||||
OPENSSL_version_patch());
|
OPENSSL_version_patch());
|
||||||
add_library("libboost", BOOST_VERSION, version_format::boost);
|
add_library("libboost", BOOST_VERSION, version_format::boost);
|
||||||
|
|
||||||
|
#ifdef DWARFS_USE_JEMALLOC
|
||||||
|
add_library("libjemalloc", get_jemalloc_version());
|
||||||
|
#endif
|
||||||
|
|
||||||
compression_registry::instance().for_each_algorithm(
|
compression_registry::instance().for_each_algorithm(
|
||||||
[this](compression_type, compression_info const& info) {
|
[this](compression_type, compression_info const& info) {
|
||||||
for (auto const& lib : info.library_dependencies()) {
|
for (auto const& lib : info.library_dependencies()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user