proc_sources = proc_net_dev.c proc_net_ip_vs_stats.c proc_diskstats.c proc_meminfo.c proc_net_netstat.c proc_net_snmp.c proc_net_stat_conntrack.c proc_stat.c proc_vmstat.c proc_net_rpc_nfsd.c
sources = procfile.c common.c log.c popen.c url.c config.c web_buffer.c storage_number.c web_client.c global_statistics.c rrd.c rrd2json.c web_server.c plugins_d.c daemon.c plugin_tc.c plugin_checks.c plugin_idlejitter.c plugin_proc.c unit_test.c main.c
-libs = -pthread -lz -lm
+libs = -pthread -lz
+
+ifdef STORAGE_WITH_MATH
+libs += -lm
+endif
# nfacct requires root access, so we prefer it as a plugin.d external plugin
ifdef INTERNAL_PLUGIN_NFACCT
+#ifdef STORAGE_WITH_MATH
#include <math.h>
+#endif
#include "log.h"
#include "storage_number.h"
mul = m;
+#ifdef STORAGE_WITH_MATH
// without this there are rounding problems
// example: 0.9 becomes 0.89
n = lrint(n);
+#endif
r = (sign << 31) + (exp << 30) + (mul << 27) + n;
// fprintf(stderr, "PACK: %08X, sign = %d, exp = %d, mul = %d, n = " CALCULATED_NUMBER_FORMAT "\n", r, sign, exp, mul, n);
#include "log.h"
#include "web_buffer.h"
-#define ACCURACY_LOSS 0.0000001
+#define ACCURACY_LOSS 100.0000001
int check_storage_number(calculated_number n, int debug) {
char buffer[100];
#include <stdlib.h>
+
+#ifdef STORAGE_WITH_MATH
#include <math.h>
+#endif
#include "web_buffer.h"
int sign = (value < 0) ? 1 : 0;
if(sign) value = -value;
+#ifdef STORAGE_WITH_MATH
// without llrint() there are rounding problems
// for example 0.9 becomes 0.89
unsigned long long uvalue = llrint(value * (calculated_number)100000);
+#else
+ unsigned long long uvalue = value * (calculated_number)100000;
+#endif
// print each digit
do *wstr++ = (char)(48 + (uvalue % 10)); while(uvalue /= 10);