projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1455 from rubenk/configure-ac-remove-dead-code
[collectd.git]
/
src
/
irq.c
diff --git
a/src/irq.c
b/src/irq.c
index
f3d5730
..
93f3f53
100644
(file)
--- a/
src/irq.c
+++ b/
src/irq.c
@@
-95,8
+95,15
@@
static int irq_read (void)
FILE *fh;
char buffer[1024];
int cpu_count;
FILE *fh;
char buffer[1024];
int cpu_count;
- char *fields[64];
-
+ char *fields[256];
+
+ /*
+ * Example content:
+ * CPU0 CPU1 CPU2 CPU3
+ * 0: 2574 1 3 2 IO-APIC-edge timer
+ * 1: 102553 158669 218062 70587 IO-APIC-edge i8042
+ * 8: 0 0 0 1 IO-APIC-edge rtc0
+ */
fh = fopen ("/proc/interrupts", "r");
if (fh == NULL)
{
fh = fopen ("/proc/interrupts", "r");
if (fh == NULL)
{
@@
-108,9
+115,12
@@
static int irq_read (void)
/* Get CPU count from the first line */
if(fgets (buffer, sizeof (buffer), fh) != NULL) {
/* Get CPU count from the first line */
if(fgets (buffer, sizeof (buffer), fh) != NULL) {
- cpu_count = strsplit (buffer, fields, 64);
+ cpu_count = strsplit (buffer, fields,
+ STATIC_ARRAY_SIZE (fields));
} else {
} else {
- ERROR ("irq plugin: unable to get CPU count from first line of /proc/interrupts");
+ ERROR ("irq plugin: unable to get CPU count from first line "
+ "of /proc/interrupts");
+ fclose (fh);
return (-1);
}
return (-1);
}
@@
-123,19
+133,19
@@
static int irq_read (void)
int fields_num;
int irq_values_to_parse;
int fields_num;
int irq_values_to_parse;
- fields_num = strsplit (buffer, fields, 64);
+ fields_num = strsplit (buffer, fields,
+ STATIC_ARRAY_SIZE (fields));
if (fields_num < 2)
continue;
/* Parse this many numeric fields, skip the rest
* (+1 because first there is a name of irq in each line) */
if (fields_num < 2)
continue;
/* Parse this many numeric fields, skip the rest
* (+1 because first there is a name of irq in each line) */
- if (fields_num >= cpu_count
+1) {
+ if (fields_num >= cpu_count
+ 1)
irq_values_to_parse = cpu_count;
irq_values_to_parse = cpu_count;
- } else {
+ else
irq_values_to_parse = fields_num - 1;
irq_values_to_parse = fields_num - 1;
- }
- /* First field is irq name */
+ /* First field is irq name
and colon
*/
irq_name = fields[0];
irq_name_len = strlen (irq_name);
if (irq_name_len < 2)
irq_name = fields[0];
irq_name_len = strlen (irq_name);
if (irq_name_len < 2)
@@
-146,6
+156,10
@@
static int irq_read (void)
if (irq_name[irq_name_len - 1] != ':')
continue;
if (irq_name[irq_name_len - 1] != ':')
continue;
+ /* Is it the the ARM fast interrupt (FIQ)? */
+ if (irq_name_len == 4 && (strncmp(irq_name, "FIQ:", 4) == 0))
+ continue;
+
irq_name[irq_name_len - 1] = 0;
irq_name_len--;
irq_name[irq_name_len - 1] = 0;
irq_name_len--;