+static _Bool report_relative_load = 0;
+
+static const char *config_keys[] = {"ReportRelative"};
+static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
+
+static int load_config(const char *key, const char *value) {
+ if (strcasecmp(key, "ReportRelative") == 0)
+#ifdef _SC_NPROCESSORS_ONLN
+ report_relative_load = IS_TRUE(value) ? 1 : 0;
+#else
+ WARNING("load plugin: The \"ReportRelative\" configuration "
+ "is not available, because I can't determine the "
+ "number of CPUS on this system. Sorry.");
+#endif
+ return -1;
+}
+static void load_submit(gauge_t snum, gauge_t mnum, gauge_t lnum) {
+ int cores = 0;
+ char errbuf[1024];
+
+#ifdef _SC_NPROCESSORS_ONLN
+ if (report_relative_load) {
+ if ((cores = sysconf(_SC_NPROCESSORS_ONLN)) < 1) {
+ WARNING("load: sysconf failed : %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
+ }
+ }
+#endif
+ if (cores > 0) {
+ snum /= cores;
+ mnum /= cores;
+ lnum /= cores;
+ }
+
+ value_list_t vl = VALUE_LIST_INIT;
+ value_t values[] = {
+ {.gauge = snum}, {.gauge = mnum}, {.gauge = lnum},
+ };
+
+ vl.values = values;
+ vl.values_len = STATIC_ARRAY_SIZE(values);