summaryrefslogtreecommitdiff
path: root/src/libvmon/vmon.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2024-09-21 15:47:54 -0700
committerVito Caputo <vcaputo@pengaru.com>2024-09-21 15:47:54 -0700
commite02654ff390253854338f4f586286f4e07912a96 (patch)
treec487deb5080e98947070b37d86cbdb41f7e52ebe /src/libvmon/vmon.c
parent2c8f7588adc95197b231ec6d15c085ad5422f0d8 (diff)
libvmon: get the number of cpus
Preparatory commit for enabling charts that scale per-thread and per-non-threaded-process CPU utilization levels by number of cpus, so they can utilize the whole row.
Diffstat (limited to 'src/libvmon/vmon.c')
-rw-r--r--src/libvmon/vmon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libvmon/vmon.c b/src/libvmon/vmon.c
index a8e2121..2815d2e 100644
--- a/src/libvmon/vmon.c
+++ b/src/libvmon/vmon.c
@@ -1011,6 +1011,9 @@ int vmon_init(vmon_t *vmon, vmon_flags_t flags, vmon_sys_wants_t sys_wants, vmon
vmon->sys_wants = sys_wants;
vmon->proc_wants = proc_wants;
vmon->ticks_per_sec = sysconf(_SC_CLK_TCK);
+ vmon->num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ if (vmon->num_cpus <= 0)
+ vmon->num_cpus = 1; /* default to 1 cpu */
/* here we populate the sys and proc function tables */
#define vmon_want(_sym, _name, _func) \
© All Rights Reserved