]> arthur.barton.de Git - netdata.git/commitdiff
Approved changes from Costa Tsaousis (#323)
authorFrederico Lamberti Pissarra <fredericopissarra@gmail.com>
Sun, 8 May 2016 23:18:39 +0000 (20:18 -0300)
committerFrederico Lamberti Pissarra <fredericopissarra@gmail.com>
Sun, 8 May 2016 23:18:39 +0000 (20:18 -0300)
src/apps_plugin.c
src/rrd.c
src/rrd2json.c
src/web_client.c

index b6396bb27e5f0a8bcc5c000e474dbfdd02db85a6..29a4cf2905c9c40983ae8f5e9cc4601a89bdb6b2 100644 (file)
@@ -1211,7 +1211,7 @@ int read_pid_file_descriptors(struct pid_stat *p) {
                                if(debug) fprintf(stderr, "apps.plugin: extending fd memory slots for %s from %d to %d\n", p->comm, p->fds_size, fdid + 100);
                                p->fds = realloc(p->fds, (fdid + 100) * sizeof(int));
                                if(!p->fds) {
-                                       error("Cannot re-allocate fds for %s", p->comm);
+                                       fatal("Cannot re-allocate fds for %s", p->comm);
                                        break;
                                }
 
@@ -2434,16 +2434,14 @@ int main(int argc, char **argv)
                exit(1);
        }
 
-       fprintf(stdout, "CHART netdata.apps_cpu '' 'Apps Plugin CPU' 'milliseconds/s' apps.plugin netdata.apps_cpu stacked 140000 %d\n", update_every);
-       fprintf(stdout, "DIMENSION user '' incremental 1 %d\n", 1000);
-       fprintf(stdout, "DIMENSION system '' incremental 1 %d\n", 1000);
-
-       fprintf(stdout, "CHART netdata.apps_files '' 'Apps Plugin Files' 'files/s' apps.plugin netdata.apps_files line 140001 %d\n", update_every);
-       fprintf(stdout, "DIMENSION files '' incremental 1 1\n");
-       fprintf(stdout, "DIMENSION pids '' absolute 1 1\n");
-       fprintf(stdout, "DIMENSION fds '' absolute 1 1\n");
-       fprintf(stdout, "DIMENSION targets '' absolute 1 1\n");
-
+       fprintf(stdout, "CHART netdata.apps_cpu '' 'Apps Plugin CPU' 'milliseconds/s' apps.plugin netdata.apps_cpu stacked 140000 %1$d\n"
+                       "DIMENSION user '' incremental 1 1000\n"
+                       "DIMENSION system '' incremental 1 1000\n"
+                       "CHART netdata.apps_files '' 'Apps Plugin Files' 'files/s' apps.plugin netdata.apps_files line 140001 %1$d\n"
+                       "DIMENSION files '' incremental 1 1\n"  
+                  "DIMENSION pids '' absolute 1 1\n"  
+                       "DIMENSION fds '' absolute 1 1\n"  
+                       "DIMENSION targets '' absolute 1 1\n", update_every);
 
 #ifndef PROFILING_MODE
        unsigned long long sunext = (time(NULL) - (time(NULL) % update_every) + update_every) * 1000000ULL;
@@ -2482,7 +2480,6 @@ int main(int argc, char **argv)
                send_collected_data_to_netdata(groups_root_target, "groups", dt);
 
                if(debug) fprintf(stderr, "apps.plugin: done Loop No %llu\n", counter);
-               fflush(NULL);
 
                current_t = time(NULL);
 
index 909533dcbe5d911a6925fcdb9d2a61d86fd060e5..de131263a576a95c529e41303f32c9f713abcdea 100644 (file)
--- a/src/rrd.c
+++ b/src/rrd.c
@@ -226,8 +226,8 @@ int rrd_memory_mode_id(const char *name)
 
 int rrddim_algorithm_id(const char *name)
 {
-       if(strcmp(name, RRDDIM_ABSOLUTE_NAME) == 0)                     return RRDDIM_ABSOLUTE;
        if(strcmp(name, RRDDIM_INCREMENTAL_NAME) == 0)                  return RRDDIM_INCREMENTAL;
+       if(strcmp(name, RRDDIM_ABSOLUTE_NAME) == 0)                     return RRDDIM_ABSOLUTE;
        if(strcmp(name, RRDDIM_PCENT_OVER_ROW_TOTAL_NAME) == 0)                 return RRDDIM_PCENT_OVER_ROW_TOTAL;
        if(strcmp(name, RRDDIM_PCENT_OVER_DIFF_TOTAL_NAME) == 0)        return RRDDIM_PCENT_OVER_DIFF_TOTAL;
        return RRDDIM_ABSOLUTE;
index 88a75044339327f91f8d12ec80ab32aa3b95ea8d..9bdff932ea7dda87d5285dbffb324c307c095982 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
+#include <math.h>
 
 #include "log.h"
 #include "common.h"
@@ -1450,7 +1451,7 @@ RRDR *rrd2rrdr(RRDSET *st, long points, long long after, long long before, int g
 
                        switch(group_method) {
                                case GROUP_MAX:
-                                       if(unlikely(abs(value) > abs(group_values[c])))
+                                       if(unlikely(fabsl(value) > fabsl(group_values[c])))
                                                group_values[c] = value;
                                        break;
 
index a98ddbd3cb49b55aeede13eb7494aa09b717f109..cbad57adf2b6cc8cdb238cb8395992980d4b77ea 100644 (file)
@@ -1196,7 +1196,7 @@ void web_client_process(struct web_client *w) {
                                                else {
                                                        code = 200;
                                                        debug_flags |= D_RRD_STATS;
-                                                       st->debug = st->debug?0:1;
+                                                       st->debug = !st->debug;
                                                        buffer_sprintf(w->response.data, "Chart %s has now debug %s.\r\n", tok, st->debug?"enabled":"disabled");
                                                        debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, st->debug?"enabled":"disabled");
                                                }