-static void memory_submit (const char *type_instance, gauge_t value, gauge_t total)
-{
- value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
-
- vl.values = values;
- vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
- sstrncpy (vl.plugin, "memory", sizeof (vl.plugin));
- sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
-
- if (values_absolute)
- {
- values[0].gauge = value;
- sstrncpy (vl.type, "memory", sizeof (vl.type));
- plugin_dispatch_values (&vl);
- }
- if (values_percentage)
- {
- values[0].gauge = 100.0 * value / total;
- sstrncpy (vl.type, "percent", sizeof (vl.type));
- plugin_dispatch_values (&vl);
- }
-}
-
-static int memory_read (void)
+#define MEMORY_SUBMIT(...) do { \
+ if (values_absolute) \
+ plugin_dispatch_multivalue (vl, 0, __VA_ARGS__, NULL); \
+ if (values_percentage) \
+ plugin_dispatch_multivalue (vl, 1, __VA_ARGS__, NULL); \
+} while (0)
+
+static int memory_read_internal (value_list_t *vl)