Approved changes from Costa Tsaousis (#323)
Frederico Lamberti Pissarra committed
May 8, 2016 at 20:18 UTC
c7c1412cf6d8b19e5eb60273ca3134bea9cf31e4
4 files changed
+13
-15
src/apps_plugin.c
+9
-12
@@ -1211,7 +1211,7 @@ int read_pid_file_descriptors(struct pid_stat *p) {
1211
if(debug) fprintf(stderr, "apps.plugin: extending fd memory slots for %s from %d to %d\n", p->comm, p->fds_size, fdid + 100);
1212
p->fds = realloc(p->fds, (fdid + 100) * sizeof(int));
1213
if(!p->fds) {
1214
- error("Cannot re-allocate fds for %s", p->comm);
1214
+ fatal("Cannot re-allocate fds for %s", p->comm);
1215
break;
1216
}
1217
@@ -2434,16 +2434,14 @@ int main(int argc, char **argv)
2434
exit(1);
2435
}
2436
2437
- fprintf(stdout, "CHART netdata.apps_cpu '' 'Apps Plugin CPU' 'milliseconds/s' apps.plugin netdata.apps_cpu stacked 140000 %d\n", update_every);
2438
- fprintf(stdout, "DIMENSION user '' incremental 1 %d\n", 1000);
2439
- fprintf(stdout, "DIMENSION system '' incremental 1 %d\n", 1000);
2440
-
2441
- fprintf(stdout, "CHART netdata.apps_files '' 'Apps Plugin Files' 'files/s' apps.plugin netdata.apps_files line 140001 %d\n", update_every);
2442
- fprintf(stdout, "DIMENSION files '' incremental 1 1\n");
2443
- fprintf(stdout, "DIMENSION pids '' absolute 1 1\n");
2444
- fprintf(stdout, "DIMENSION fds '' absolute 1 1\n");
2445
- fprintf(stdout, "DIMENSION targets '' absolute 1 1\n");
2446
-
2437
+ fprintf(stdout, "CHART netdata.apps_cpu '' 'Apps Plugin CPU' 'milliseconds/s' apps.plugin netdata.apps_cpu stacked 140000 %1$d\n"
2438
+ "DIMENSION user '' incremental 1 1000\n"
2439
+ "DIMENSION system '' incremental 1 1000\n"
2440
+ "CHART netdata.apps_files '' 'Apps Plugin Files' 'files/s' apps.plugin netdata.apps_files line 140001 %1$d\n"
2441
+ "DIMENSION files '' incremental 1 1\n"
2442
+ "DIMENSION pids '' absolute 1 1\n"
2443
+ "DIMENSION fds '' absolute 1 1\n"
2444
+ "DIMENSION targets '' absolute 1 1\n", update_every);
2445
2446
#ifndef PROFILING_MODE
2447
unsigned long long sunext = (time(NULL) - (time(NULL) % update_every) + update_every) * 1000000ULL;
@@ -2482,7 +2480,6 @@ int main(int argc, char **argv)
2480
send_collected_data_to_netdata(groups_root_target, "groups", dt);
2481
2482
if(debug) fprintf(stderr, "apps.plugin: done Loop No %llu\n", counter);
2485
- fflush(NULL);
2483
2484
current_t = time(NULL);
2485
src/rrd.c
+1
-1
@@ -226,8 +226,8 @@ int rrd_memory_mode_id(const char *name)
226
227
int rrddim_algorithm_id(const char *name)
228
{
229
- if(strcmp(name, RRDDIM_ABSOLUTE_NAME) == 0) return RRDDIM_ABSOLUTE;
229
if(strcmp(name, RRDDIM_INCREMENTAL_NAME) == 0) return RRDDIM_INCREMENTAL;
230
+ if(strcmp(name, RRDDIM_ABSOLUTE_NAME) == 0) return RRDDIM_ABSOLUTE;
231
if(strcmp(name, RRDDIM_PCENT_OVER_ROW_TOTAL_NAME) == 0) return RRDDIM_PCENT_OVER_ROW_TOTAL;
232
if(strcmp(name, RRDDIM_PCENT_OVER_DIFF_TOTAL_NAME) == 0) return RRDDIM_PCENT_OVER_DIFF_TOTAL;
233
return RRDDIM_ABSOLUTE;
src/rrd2json.c
+2
-1
@@ -5,6 +5,7 @@
5
#include <stdlib.h>
6
#include <string.h>
7
#include <stdint.h>
8
+#include <math.h>
9
10
#include "log.h"
11
#include "common.h"
@@ -1450,7 +1451,7 @@ RRDR *rrd2rrdr(RRDSET *st, long points, long long after, long long before, int g
1451
1452
switch(group_method) {
1453
case GROUP_MAX:
1453
- if(unlikely(abs(value) > abs(group_values[c])))
1454
+ if(unlikely(fabsl(value) > fabsl(group_values[c])))
1455
group_values[c] = value;
1456
break;
1457
src/web_client.c
+1
-1
@@ -1196,7 +1196,7 @@ void web_client_process(struct web_client *w) {
1196
else {
1197
code = 200;
1198
debug_flags |= D_RRD_STATS;
1199
- st->debug = st->debug?0:1;
1199
+ st->debug = !st->debug;
1200
buffer_sprintf(w->response.data, "Chart %s has now debug %s.\r\n", tok, st->debug?"enabled":"disabled");
1201
debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, st->debug?"enabled":"disabled");
1202
}