diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2022-12-09 18:56:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 18:56:48 +0200 |
commit | c728bfc1eb00a662a24010d2b33e287d44d2a09b (patch) | |
tree | 8c2064f3d5955d9456943c78c3de4a8c9f767c44 /collectors | |
parent | 32d63fe9a6a18c9e757499f0e23a1169b516f9bf (diff) |
fix get_system_cpus() (#14116)
Diffstat (limited to 'collectors')
-rw-r--r-- | collectors/apps.plugin/apps_plugin.c | 4 | ||||
-rw-r--r-- | collectors/proc.plugin/proc_stat.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c index 4de5915fd4..75f4a50685 100644 --- a/collectors/apps.plugin/apps_plugin.c +++ b/collectors/apps.plugin/apps_plugin.c @@ -3359,7 +3359,7 @@ static void normalize_utilization(struct target *root) { // here we try to eliminate them by disabling childs processing either for specific dimensions // or entirely. Of course, either way, we disable it just a single iteration. - kernel_uint_t max_time = processors * time_factor * RATES_DETAIL; + kernel_uint_t max_time = get_system_cpus() * time_factor * RATES_DETAIL; kernel_uint_t utime = 0, cutime = 0, stime = 0, cstime = 0, gtime = 0, cgtime = 0, minflt = 0, cminflt = 0, majflt = 0, cmajflt = 0; if(global_utime > max_time) global_utime = max_time; @@ -4898,7 +4898,7 @@ int main(int argc, char **argv) { #endif get_system_pid_max(); - get_system_cpus(); + get_system_cpus_uncached(); parse_args(argc, argv); diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c index 33fe932343..4fe332e524 100644 --- a/collectors/proc.plugin/proc_stat.c +++ b/collectors/proc.plugin/proc_stat.c @@ -483,7 +483,7 @@ int do_proc_stat(int update_every, usec_t dt) { *time_in_state_filename = NULL, *schedstat_filename = NULL, *cpuidle_name_filename = NULL, *cpuidle_time_filename = NULL; static const RRDVAR_ACQUIRED *cpus_var = NULL; static int accurate_freq_avail = 0, accurate_freq_is_used = 0; - size_t cores_found = (size_t)processors; + size_t cores_found = (size_t)get_system_cpus(); if(unlikely(do_cpu == -1)) { do_cpu = config_get_boolean("plugin:proc:/proc/stat", "cpu utilization", CONFIG_BOOLEAN_YES); @@ -494,7 +494,7 @@ int do_proc_stat(int update_every, usec_t dt) { do_processes = config_get_boolean("plugin:proc:/proc/stat", "processes running", CONFIG_BOOLEAN_YES); // give sane defaults based on the number of processors - if(unlikely(processors > 50)) { + if(unlikely(get_system_cpus() > 50)) { // the system has too many processors keep_per_core_fds_open = CONFIG_BOOLEAN_NO; do_core_throttle_count = CONFIG_BOOLEAN_NO; @@ -510,7 +510,7 @@ int do_proc_stat(int update_every, usec_t dt) { do_cpu_freq = CONFIG_BOOLEAN_YES; do_cpuidle = CONFIG_BOOLEAN_YES; } - if(unlikely(processors > 24)) { + if(unlikely(get_system_cpus() > 24)) { // the system has too many processors keep_cpuidle_fds_open = CONFIG_BOOLEAN_NO; } |