From: Florian Forster Date: Fri, 2 Sep 2011 01:28:05 +0000 (-0400) Subject: Merge branch 'collectd-4.10' into collectd-5.0 X-Git-Tag: collectd-5.0.1~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=61fba41289decabc1a18c855fcd462fece9ab983;p=collectd.git Merge branch 'collectd-4.10' into collectd-5.0 Conflicts: src/irq.c Change-Id: Ie6c78234f07cc5b7bac7e6914813e9545ce1b1af --- 61fba41289decabc1a18c855fcd462fece9ab983 diff --cc src/irq.c index 94e42537,70d6b5ab..7e738291 --- a/src/irq.c +++ b/src/irq.c @@@ -116,16 -106,15 +106,15 @@@ static int check_ignore_irq (const cha return (1 - irq_list_action); } - static void irq_submit (unsigned int irq, derive_t value) -static void irq_submit (const char *irq_name, counter_t value) ++static void irq_submit (const char *irq_name, derive_t value) { value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - int status; - if (check_ignore_irq (irq)) + if (check_ignore_irq (irq_name)) return; - values[0].counter = value; + values[0].derive = value; vl.values = values; vl.values_len = 1; @@@ -154,16 -145,10 +139,16 @@@ static int irq_read (void sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); } + - while (fgets (buffer, BUFSIZE, fh) != NULL) + while (fgets (buffer, sizeof (buffer), fh) != NULL) { - unsigned int irq; + char *irq_name; + size_t irq_name_len; + derive_t irq_value; - char *endptr; + int i; + + char *fields[64]; + int fields_num; fields_num = strsplit (buffer, fields, 64); if (fields_num < 2) @@@ -178,21 -170,23 +170,22 @@@ irq_value = 0; for (i = 1; i < fields_num; i++) { - errno = 0; - endptr = NULL; - value = strtoull (fields[i], &endptr, 10); + /* Per-CPU value */ + value_t v; + int status; - /* Ignore all fields following a non-numeric field. */ - if ((errno != 0) || (endptr == NULL) || (*endptr != 0)) + status = parse_value (fields[i], &v, DS_TYPE_DERIVE); + if (status != 0) break; - irq_value += value; + irq_value += v.derive; } /* for (i) */ - if (i < fields_num) + /* No valid fields -> do not submit anything. */ + if (i <= 1) continue; - irq_submit (irq, irq_value); - /* Force 32bit wrap-around */ - irq_submit (irq_name, irq_value % 4294967296ULL); ++ irq_submit (irq_name, irq_value); } fclose (fh);