增加jemalloc工具类, 增加jemalloc内存统计分析 (#2885)

增加jemalloc工具类, 增加jemalloc内存统计分析
This commit is contained in:
alexliyu7352
2023-10-10 11:48:56 +08:00
committed by GitHub
parent db3f0147be
commit fdc00d5a02
3 changed files with 123 additions and 2 deletions

30
src/Common/JemallocUtil.h Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#ifndef ZLMEDIAKIT_JEMALLOCUTIL_H
#define ZLMEDIAKIT_JEMALLOCUTIL_H
#include <functional>
#include <string>
namespace mediakit {
class JemallocUtil {
public:
JemallocUtil() = default;
~JemallocUtil() = default;
static void enable_profiling();
static void disable_profiling();
static void dump(const std::string &file_name);
static std::string get_malloc_stats();
static void some_malloc_stats(const std::function<void(const char *, uint64_t)> &fn);
};
} // namespace mediakit
#endif // ZLMEDIAKIT_JEMALLOCUTIL_H