]> arthur.barton.de Git - netdata.git/blobdiff - src/proc_softirqs.c
added more fping alarms; added the ability to have alarms that never send CLEAR notif...
[netdata.git] / src / proc_softirqs.c
index 069e83ce199c37838718f8f15ff1ccec039574f6..c7b10d70df85d062f2d9f2b08ba320ce7bc9f55b 100644 (file)
@@ -23,9 +23,9 @@ struct interrupt {
 // given a base, get a pointer to each record
 #define irrindex(base, line, cpus) ((struct interrupt *)&((char *)(base))[line * recordsize(cpus)])
 
-static inline struct interrupt *get_interrupts_array(int lines, int cpus) {
+static inline struct interrupt *get_interrupts_array(size_t lines, int cpus) {
     static struct interrupt *irrs = NULL;
-    static int allocated = 0;
+    static size_t allocated = 0;
 
     if(unlikely(lines != allocated)) {
         uint32_t l;
@@ -48,7 +48,7 @@ static inline struct interrupt *get_interrupts_array(int lines, int cpus) {
     return irrs;
 }
 
-int do_proc_softirqs(int update_every, unsigned long long dt) {
+int do_proc_softirqs(int update_every, usec_t dt) {
     (void)dt;
     static procfile *ff = NULL;
     static int cpus = -1, do_per_core = -1;
@@ -66,8 +66,8 @@ int do_proc_softirqs(int update_every, unsigned long long dt) {
     ff = procfile_readall(ff);
     if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
 
-    uint32_t lines = procfile_lines(ff), l;
-    uint32_t words = procfile_linewords(ff, 0);
+    size_t lines = procfile_lines(ff), l;
+    size_t words = procfile_linewords(ff, 0);
 
     if(unlikely(!lines)) {
         error("Cannot read /proc/softirqs, zero lines reported.");
@@ -105,14 +105,14 @@ int do_proc_softirqs(int update_every, unsigned long long dt) {
         irr->id = procfile_lineword(ff, l, 0);
         if(unlikely(!irr->id || !irr->id[0])) continue;
 
-        int idlen = strlen(irr->id);
-        if(unlikely(irr->id[idlen - 1] == ':'))
+        size_t idlen = strlen(irr->id);
+        if(unlikely(idlen && irr->id[idlen - 1] == ':'))
             irr->id[idlen - 1] = '\0';
 
         int c;
         for(c = 0; c < cpus ;c++) {
             if(likely((c + 1) < (int)words))
-                irr->cpu[c].value = strtoull(procfile_lineword(ff, l, (uint32_t)(c + 1)), NULL, 10);
+                irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1)));
             else
                 irr->cpu[c].value = 0;