diff --git a/src/mod/common/stats.c b/src/mod/common/stats.c index 3144475c..b6893149 100644 --- a/src/mod/common/stats.c +++ b/src/mod/common/stats.c @@ -4,6 +4,7 @@ #include #include #include "mod/common/wkmalloc.h" +#include "mod/common/linux_version.h" struct jool_mib { unsigned long mibs[JSTAT_COUNT]; @@ -79,8 +80,15 @@ __u64 *jstat_query(struct jool_stats *stats) if (!result) return NULL; - for (i = 0; i < JSTAT_COUNT; i++) + for (i = 0; i < JSTAT_COUNT; i++) { +#if LINUX_VERSION_AT_LEAST(7, 2, 0, 0, 0) + int cpu; + for_each_possible_cpu(cpu) + result[i] += snmp_get_cpu_field(stats->mib, cpu, i); +#else result[i] = snmp_fold_field(stats->mib, i); +#endif + } return result; }