summaryrefslogtreecommitdiffstats
path: root/collectors/macos.plugin/macos_mach_smi.c
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2022-11-22 04:52:15 +0200
committerGitHub <noreply@github.com>2022-11-22 04:52:15 +0200
commit2d5f3acf71f0c759056a3269987fee484566bc4c (patch)
tree5246e1080ea721ba84e5f749f8d8e98d978d81c8 /collectors/macos.plugin/macos_mach_smi.c
parent147552807bc19af949fe3cb315c4743dadfa7f0b (diff)
Do not force internal collectors to call rrdset_next. (#13926)
* Remove calls to rrdset_next(). * Rm checks plugin * Update documentantion * Call rrdset_next from within rrdset_done This wraps up the removal of rrdset_next from internal collectors, which removes a lot of unecessary code and the need for if/else clauses in every place. The pluginsd parser is the only component that calls rrdset_next*() functions because it's not strictly speaking a collector but more of a collector manager/proxy. With the current changes it's possible to simplify the API we expose from RRD significantly, but this will be follow-up work in the future. * Remove stale reference to checks.plugin * Fix RRD unit test rrdset_next is not meant to be called from these tests. * Fix db engine unit test. * Schedule rrdset_next when we have completed at least one collection. * Mark chart creation clauses as unlikely. * Add missing brace to fix FreeBSD plugin.
Diffstat (limited to 'collectors/macos.plugin/macos_mach_smi.c')
-rw-r--r--collectors/macos.plugin/macos_mach_smi.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/collectors/macos.plugin/macos_mach_smi.c b/collectors/macos.plugin/macos_mach_smi.c
index f2c4623c96..53b2607b43 100644
--- a/collectors/macos.plugin/macos_mach_smi.c
+++ b/collectors/macos.plugin/macos_mach_smi.c
@@ -39,8 +39,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
if (unlikely(kr != KERN_SUCCESS))
return -1;
- // --------------------------------------------------------------------
-
if (likely(do_cpu)) {
if (unlikely(HOST_CPU_LOAD_INFO_COUNT != 4)) {
error("MACOS: There are %d CPU states (4 was expected)", HOST_CPU_LOAD_INFO_COUNT);
@@ -78,7 +76,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
rrddim_add(st, "idle", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
rrddim_hide(st, "idle");
}
- else rrdset_next(st);
rrddim_set(st, "user", cp_time[CPU_STATE_USER]);
rrddim_set(st, "nice", cp_time[CPU_STATE_NICE]);
@@ -87,9 +84,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
rrdset_done(st);
}
}
- }
-
- // --------------------------------------------------------------------
+ }
if (likely(do_ram || do_swapio || do_pgfaults)) {
#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
@@ -137,7 +132,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
rrddim_add(st, "speculative", NULL, system_pagesize, 1048576, RRD_ALGORITHM_ABSOLUTE);
rrddim_add(st, "free", NULL, system_pagesize, 1048576, RRD_ALGORITHM_ABSOLUTE);
}
- else rrdset_next(st);
rrddim_set(st, "active", vm_statistics.active_count);
rrddim_set(st, "wired", vm_statistics.wire_count);
@@ -153,8 +147,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
}
#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)
- // --------------------------------------------------------------------
-
if (likely(do_swapio)) {
st = rrdset_find_active_localhost("system.swapio");
if (unlikely(!st)) {
@@ -176,7 +168,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
rrddim_add(st, "in", NULL, system_pagesize, 1024, RRD_ALGORITHM_INCREMENTAL);
rrddim_add(st, "out", NULL, -system_pagesize, 1024, RRD_ALGORITHM_INCREMENTAL);
}
- else rrdset_next(st);
rrddim_set(st, "in", vm_statistics.swapins);
rrddim_set(st, "out", vm_statistics.swapouts);
@@ -184,8 +175,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
}
#endif
- // --------------------------------------------------------------------
-
if (likely(do_pgfaults)) {
st = rrdset_find_active_localhost("mem.pgfaults");
if (unlikely(!st)) {
@@ -217,7 +206,6 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
rrddim_add(st, "reactivate", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
rrddim_add(st, "purge", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
}
- else rrdset_next(st);
rrddim_set(st, "memory", vm_statistics.faults);
rrddim_set(st, "cow", vm_statistics.cow_faults);
@@ -235,7 +223,5 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
}
}
- // --------------------------------------------------------------------
-
return 0;
}