fix: *really* disable the performance monitor if requested

This commit is contained in:
Marcus Holland-Moritz 2025-04-13 22:27:19 +02:00
parent e6ae08475a
commit 7b78074ce7
3 changed files with 10 additions and 5 deletions

View File

@ -40,7 +40,7 @@ add_library(
src/option_map.cpp
src/os_access_generic.cpp
src/pcm_sample_transformer.cpp
src/performance_monitor.cpp
$<IF:$<BOOL:${ENABLE_PERFMON}>,src/performance_monitor.cpp,>
src/terminal_ansi.cpp
src/thread_pool.cpp
src/util.cpp

View File

@ -1525,7 +1525,6 @@ void load_filesystem(dwarfs_userdata& userdata) {
perfmon_trace_file = userdata.iol.os->canonical(std::filesystem::path(
reinterpret_cast<char8_t const*>(opts.perfmon_trace_file_str)));
}
#endif
userdata.perfmon = performance_monitor::create(
perfmon_enabled, userdata.iol.file, perfmon_trace_file);
@ -1541,6 +1540,7 @@ void load_filesystem(dwarfs_userdata& userdata) {
PERFMON_EXT_TIMER_SETUP(userdata, op_statfs)
PERFMON_EXT_TIMER_SETUP(userdata, op_getxattr, "inode")
PERFMON_EXT_TIMER_SETUP(userdata, op_listxattr, "inode")
#endif
if (opts.analysis_file_str) {
auto file = userdata.iol.os->canonical(std::filesystem::path(

View File

@ -191,18 +191,23 @@ int dwarfsextract_main(int argc, sys_char** argv, iolayer const& iol) {
fsopts.block_cache.disable_block_integrity_check = disable_integrity_check;
fsopts.metadata.enable_nlink = true;
std::shared_ptr<performance_monitor> perfmon;
#if DWARFS_PERFMON_ENABLED
std::unordered_set<std::string> perfmon_enabled;
std::optional<std::filesystem::path> perfmon_trace_file;
#if DWARFS_PERFMON_ENABLED
if (!perfmon_str.empty()) {
split_to(perfmon_str, ',', perfmon_enabled);
}
if (!trace_file.empty()) {
perfmon_trace_file = iol.os->canonical(trace_file);
}
perfmon = performance_monitor::create(perfmon_enabled, iol.file,
perfmon_trace_file);
#endif
std::shared_ptr<performance_monitor> perfmon = performance_monitor::create(
perfmon_enabled, iol.file, perfmon_trace_file);
reader::filesystem_v2_lite fs(lgr, *iol.os, fs_image, fsopts, perfmon);
utility::filesystem_extractor fsx(lgr, *iol.os);