Browse Source

Use AND for IRQ's cpumasks

Serj Kalichev 10 years ago
parent
commit
eec075f091
3 changed files with 15 additions and 11 deletions
  1. 11 0
      birq.c
  2. 3 2
      irq_parse.c
  3. 1 9
      statistics.c

+ 11 - 0
birq.c

@@ -19,6 +19,7 @@
 #include <signal.h>
 #include <syslog.h>
 #include <fcntl.h>
+#include <time.h>
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif
@@ -131,9 +132,19 @@ int main(int argc, char **argv)
 	/* Main loop */
 	while (!sigterm) {
 		lub_list_node_t *node;
+		char outstr[10];
+		time_t t;
+		struct tm *tmp;
+
+		t = time(NULL);
+		tmp = localtime(&t);
+		strftime(outstr, sizeof(outstr), "%H:%M:%S", tmp);
+		printf("----[ %s ]----------------------------------------------------------------\n", outstr);
 
 		/* Rescan PCI devices for new IRQs. */
 		scan_irqs(irqs, balance_irqs);
+		if (opts->verbose)
+			irq_list_show(irqs);
 
 		/* Gather statistics on CPU load and number of interrupts. */
 		gather_statistics(cpus, irqs);

+ 3 - 2
irq_parse.c

@@ -122,6 +122,7 @@ static int parse_local_cpus(lub_list_t *irqs, const char *sysfs_path,
 	char *str = NULL;
 	size_t sz;
 	irq_t *irq;
+	cpumask_t local_cpus;
 
 	irq = irq_list_search(irqs, num);
 	if (!irq)
@@ -135,8 +136,8 @@ static int parse_local_cpus(lub_list_t *irqs, const char *sysfs_path,
 		return -1;
 	}
 	fclose(fd);
-	cpumask_parse_user(str, strlen(str), irq->local_cpus);
-//	printf("%d %s %s\n", num, str, sysfs_path);
+	cpumask_parse_user(str, strlen(str), local_cpus);
+	cpus_and(irq->local_cpus, irq->local_cpus, local_cpus);
 	free(str);
 
 	return 0;

+ 1 - 9
statistics.c

@@ -9,7 +9,6 @@
 #include <dirent.h>
 #include <limits.h>
 #include <ctype.h>
-#include <time.h>
 
 #include "statistics.h"
 #include "cpu.h"
@@ -120,14 +119,7 @@ void gather_statistics(lub_list_t *cpus, lub_list_t *irqs)
 void show_statistics(lub_list_t *cpus, int verbose)
 {
 	lub_list_node_t *iter;
-	char outstr[10];
-	time_t t;
-	struct tm *tmp;
-
-	t = time(NULL);
-	tmp = localtime(&t);
-	strftime(outstr, sizeof(outstr), "%H:%M:%S", tmp);
-	printf("----[ %s ]----------------------------------------------------------------\n", outstr);
+
 	for (iter = lub_list_iterator_init(cpus); iter;
 		iter = lub_list_iterator_next(iter)) {
 		cpu_t *cpu;