From: Kienan Stewart Date: Wed, 13 Nov 2024 19:55:44 +0000 (-0500) Subject: lttng-ctl: Use max possible CPUs for per-CPU memory estimation X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=75a29edff3018f56afafbca0a09be444d3f23af6;p=lttng-tools.git lttng-ctl: Use max possible CPUs for per-CPU memory estimation As of 2.13.4, LTTng-UST uses the max possible CPU count for per-CPU allocations. See lttng-ust commit 66dbdc3448a77043d0fd59f47b17e77a8d59fddb ("fix: num_possible_cpus() with hot-unplugged CPUs"). Change-Id: Ia4eb25988a268f48065903617ed59a5fdecb2ab9 Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- diff --git a/src/lib/lttng-ctl/lttng-ctl.cpp b/src/lib/lttng-ctl/lttng-ctl.cpp index 24733e82e..8ba7d657a 100644 --- a/src/lib/lttng-ctl/lttng-ctl.cpp +++ b/src/lib/lttng-ctl/lttng-ctl.cpp @@ -309,8 +309,9 @@ static enum lttng_error_code check_enough_available_memory(uint64_t num_bytes_re * Get the number of CPU currently online to compute the amount of * memory needed to create a buffer for every CPU. */ - num_cpu = sysconf(_SC_NPROCESSORS_ONLN); - if (num_cpu == -1) { + try { + num_cpu = long(utils_get_cpu_count()); + } catch (const std::exception& ex) { ret_code = LTTNG_ERR_FATAL; goto end; }