/* Interrupts statistics */
struct activity irq_act = {
.id = A_IRQ,
- .options = AO_COUNTED,
- .magic = ACTIVITY_MAGIC_BASE + 1,
+ .options = AO_COUNTED + AO_MATRIX,
+ .magic = ACTIVITY_MAGIC_BASE + 2,
.group = G_INT,
#ifdef SOURCE_SADC
- .f_count_index = 1, /* wrap_get_irq_nr() */
- .f_count2_index = -1,
+ .f_count_index = 0, /* wrap_get_cpu_nr() */
+ .f_count2_index = 1, /* wrap_get_irq_nr() */
.f_read = wrap_read_stat_irq,
#endif
#ifdef SOURCE_SAR
.item_list_sz = 0,
.g_nr = 0,
.nr_ini = -1,
- .nr2 = 1,
+ .nr2 = -1,
.nr_max = NR_IRQS + 1,
.nr = {-1, -1, -1},
.nr_allocated = 0,
#ifdef SOURCE_SADC
/*---------------- BEGIN: FUNCTIONS USED BY SADC ONLY ---------------------*/
-/*
- ***************************************************************************
- * Count number of interrupts that are in /proc/stat file.
- *
- * RETURNS:
- * Number of interrupts, including total number of interrupts.
- ***************************************************************************
- */
-__nr_t get_irq_nr(void)
-{
- FILE *fp;
- char line[8192];
- __nr_t in = 0;
- int pos = 4;
-
- if ((fp = fopen(STAT, "r")) == NULL)
- return 0;
-
- while (fgets(line, sizeof(line), fp) != NULL) {
-
- if (!strncmp(line, "intr ", 5)) {
-
- while (pos < strlen(line)) {
- in++;
- pos += strcspn(line + pos + 1, " ") + 1;
- }
- }
- }
-
- fclose(fp);
-
- return in;
-}
-
/*
***************************************************************************
* Find number of serial lines that support tx/rx accounting
(char *, int, int);
__nr_t get_diskstats_dev_nr
(int, int);
-__nr_t get_irq_nr
- (void);
__nr_t get_serial_nr
(void);
__nr_t get_iface_nr
/*
***************************************************************************
- * Count number of interrupts that are in /proc/stat file.
+ * Count number of interrupts that are in /proc/interrupts file, including
+ * total number of interrupts.
* Truncate the number of different individual interrupts to NR_IRQS.
*
* IN:
{
__nr_t n;
- if ((n = get_irq_nr()) > (a->bitmap->b_size + 1)) {
- n = a->bitmap->b_size + 1;
+ /*
+ * Get number of different interrupts.
+ * Number of CPU (including CPU "all") has already been calculated and saved in a->nr_ini.
+ */
+ n = get_irqcpu_nr(INTERRUPTS, a->bitmap->b_size, a->nr_ini - 1);
+ if (n > 0) {
+ n++; /* Add 1 for total number of interrupts. A value of bitmap->b_size + 1 is OK. */
}
return n;