int show_interrupts(struct seq_file *p, void *v) { unsigned long flags, any_count = 0; int i = *(loff_t *) v, j; struct irqaction *action; struct irq_desc *desc; if (i > nr_irqs) return 0; if (i == nr_irqs) return show_other_interrupts(p); /* print header */ if (i == 0) { seq_printf(p, " "); for_each_online_cpu(j) seq_printf(p, "CPU%-8d", j); seq_putc(p, '\n'); } desc = irq_to_desc(i); if (!desc) return 0; spin_lock_irqsave(&desc->lock, flags); #ifndef CONFIG_SMP any_count = kstat_irqs(i); #else for_each_online_cpu(j) any_count |= kstat_irqs_cpu(i, j); #endif action = desc->action; if (!action && !any_count) goto out; seq_printf(p, "%3d: ", i); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(i)); #else for_each_online_cpu(j) seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); #endif seq_printf(p, " %8s", desc->chip->name); seq_printf(p, "-%-8s", desc->name); if (action) { seq_printf(p, " %s", action->name); while ((action = action->next) != NULL) seq_printf(p, ", %s", action->name); } seq_putc(p, '\n'); out: spin_unlock_irqrestore(&desc->lock, flags); return 0; }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v; struct irqaction *action; unsigned long flags; if (i < NR_IRQS) { spin_lock_irqsave(&irq_desc[i].lock, flags); action = irq_desc[i].action; if (!action) goto unlock; seq_printf(p, "%3d: %10u ", i, kstat_irqs(i)); seq_printf(p, " %s", action->name); for (action = action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); unlock: spin_unlock_irqrestore(&irq_desc[i].lock, flags); } else if (i == NR_IRQS) { seq_printf(p, "Err: %10lu\n", irq_err_count); } return 0; }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v; struct irqaction * action; unsigned long flags; if (i == 0) seq_puts(p, " CPU0"); if (i < NR_IRQS) { raw_spin_lock_irqsave(&irq_desc[i].lock, flags); action = irq_desc[i].action; if (!action) goto unlock; seq_printf(p, "%3d: ",i); seq_printf(p, "%10u ", kstat_irqs(i)); seq_printf(p, " %14s", irq_desc[i].irq_data.chip->name); seq_printf(p, "-%-8s", irq_desc[i].name); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); unlock: raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); } return 0; }
int get_irq_list(char *buf) { struct irqaction * action; char *p = buf; int i; p += sprintf(p, " "); for (i=0; i < 1 /*smp_num_cpus*/; i++) p += sprintf(p, "CPU%d ", i); *p++ = '\n'; for (i = 0 ; i < NR_IRQS ; i++) { action = irq_desc[i].action; if (!action) continue; p += sprintf(p, "%3d: ",i); p += sprintf(p, "%10u ", kstat_irqs(i)); p += sprintf(p, " %14s", irq_desc[i].handler->typename); p += sprintf(p, " %s", action->name); for (action=action->next; action; action = action->next) p += sprintf(p, ", %s", action->name); *p++ = '\n'; } p += sprintf(p, "ERR: %10lu\n", irq_err_count); return p - buf; }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v, j; struct irqaction * action; unsigned long flags; if (i == 0) { seq_printf(p, " "); for_each_online_cpu(j) seq_printf(p, "CPU%d ",j); seq_putc(p, '\n'); } if (i < NR_IRQS) { spin_lock_irqsave(&irq_desc[i].lock, flags); action = irq_desc[i].action; if (!action) goto skip; seq_printf(p, "%3d: ",i); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(i)); #else for_each_online_cpu(j) seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); #endif seq_printf(p, " %14s", irq_desc[i].chip->typename); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); skip: spin_unlock_irqrestore(&irq_desc[i].lock, flags); } else if (i == NR_IRQS)
int show_interrupts(struct seq_file *p, void *v) { struct irqaction *ap; int irq = *((loff_t *) v); if (irq == 0) seq_puts(p, " CPU0\n"); if (irq < NR_IRQS) { struct irq_desc *desc = irq_to_desc(irq); ap = desc->action; if (ap) { seq_printf(p, "%3d: ", irq); seq_printf(p, "%10u ", kstat_irqs(irq)); seq_printf(p, "%14s ", irq_desc_get_chip(desc)->name); seq_printf(p, "%s", ap->name); for (ap = ap->next; ap; ap = ap->next) seq_printf(p, ", %s", ap->name); seq_putc(p, '\n'); } } return 0; }
int get_irq_list(char *buf) { int i, j; struct irqaction * action; char *p = buf; p += sprintf(p, " "); for (j=0; j<smp_num_cpus; j++) p += sprintf(p, "CPU%d ",j); *p++ = '\n'; for (i = 0 ; i < NR_IRQS ; i++) { action = irq_desc[i].action; if (!action) continue; p += sprintf(p, "%3d: ",i); #ifndef CONFIG_SMP p += sprintf(p, "%10u ", kstat_irqs(i)); #else for (j = 0; j < smp_num_cpus; j++) p += sprintf(p, "%10u ", kstat.irqs[cpu_logical_map(j)][i]); #endif p += sprintf(p, " %14s", irq_desc[i].handler->typename); p += sprintf(p, " %s", action->name); for (action=action->next; action; action = action->next) p += sprintf(p, ", %s", action->name); *p++ = '\n'; } p += sprintf(p, "\n"); p += sprintf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); return p - buf; }
int show_interrupts(struct seq_file *p, void *v) { struct irqaction * action; int i; seq_puts(p, " "); for (i=0; i < 1 /*smp_num_cpus*/; i++) seq_printf(p, "CPU%d ", i); seq_putc(p, '\n'); for (i = 0 ; i < NR_IRQS ; i++) { action = irq_desc[i].action; if (!action) continue; seq_printf(p, "%3d: ",i); seq_printf(p, "%10u ", kstat_irqs(i)); seq_printf(p, " %14s", irq_desc[i].handler->typename); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); } seq_printf(p, "ERR: %10lu\n", irq_err_count); return 0; }
int get_irq_list(char *buf) { int i, j; struct irqaction * action; char *p = buf; p += sprintf(p, " "); for (j=0; j<smp_num_cpus; j++) p += sprintf(p, "CPU%d ",j); *p++ = '\n'; for (i = 0 ; i < NR_IRQS ; i++) { action = irq_desc[i].action; if (!action) continue; p += sprintf(p, "%3d: ",i); p += sprintf(p, "%10u ", kstat_irqs(i)); p += sprintf(p, " %14s", irq_desc[i].handler->typename); p += irq_describe(p, i); p += sprintf(p, " %s", action->name); for (action=action->next; action; action = action->next) p += sprintf(p, ", %s", action->name); *p++ = '\n'; } #if 0 p += sprintf(p, "NMI: "); for (j = 0; j < smp_num_cpus; j++) p += sprintf(p, "%10u ", atomic_read(&nmi_counter(cpu_logical_map(j)))); p += sprintf(p, "\n"); #endif return p - buf; }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v, j; struct irqaction * action; unsigned long flags; if (i == 0) { seq_puts(p, " "); for (j=0; j<NR_CPUS; j++) if (cpu_online(j)) seq_printf(p, "CPU%d ",j); seq_putc(p, '\n'); } if (i < ACTUAL_NR_IRQS) { spin_lock_irqsave(&irq_desc[i].lock, flags); action = irq_desc[i].action; if (!action) goto unlock; seq_printf(p, "%3d: ",i); seq_printf(p, "%10u ", kstat_irqs(i)); seq_printf(p, " %14s", irq_desc[i].handler->typename); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); unlock: spin_unlock_irqrestore(&irq_desc[i].lock, flags); }
static int __devinit init_card(struct IsdnCardState *cs) { int irq_cnt, cnt = 3; long flags; if (!cs->irq) return(cs->cardmsg(cs, CARD_INIT, NULL)); save_flags(flags); cli(); irq_cnt = kstat_irqs(cs->irq); printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], cs->irq, irq_cnt); if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) { printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n", cs->irq); restore_flags(flags); return(1); } while (cnt) { cs->cardmsg(cs, CARD_INIT, NULL); sti(); set_current_state(TASK_UNINTERRUPTIBLE); /* Timeout 10ms */ schedule_timeout((10*HZ)/1000); restore_flags(flags); printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], cs->irq, kstat_irqs(cs->irq)); if (kstat_irqs(cs->irq) == irq_cnt) { printk(KERN_WARNING "%s: IRQ(%d) getting no interrupts during init %d\n", CardType[cs->typ], cs->irq, 4 - cnt); if (cnt == 1) { free_irq(cs->irq, cs); return (2); } else { cs->cardmsg(cs, CARD_RESET, NULL); cnt--; } } else { cs->cardmsg(cs, CARD_TEST, NULL); return(0); } } restore_flags(flags); return(3); }
/** * kstat_irqs_usr - Get the statistics for an interrupt * @irq: The interrupt number * * Returns the sum of interrupt counts on all cpus since boot for * @irq. Contrary to kstat_irqs() this can be called from any * preemptible context. It's protected against concurrent removal of * an interrupt descriptor when sparse irqs are enabled. */ unsigned int kstat_irqs_usr(unsigned int irq) { int sum; irq_lock_sparse(); sum = kstat_irqs(irq); irq_unlock_sparse(); return sum; }
/** * kstat_irqs_usr - Get the statistics for an interrupt * @irq: The interrupt number * * Returns the sum of interrupt counts on all cpus since boot for @irq. * Contrary to kstat_irqs() this can be called from any context. * It uses rcu since a concurrent removal of an interrupt descriptor is * observing an rcu grace period before delayed_free_desc()/irq_kobj_release(). */ unsigned int kstat_irqs_usr(unsigned int irq) { unsigned int sum; rcu_read_lock(); sum = kstat_irqs(irq); rcu_read_unlock(); return sum; }
int show_interrupts(struct seq_file *p, void *v) { #ifdef CONFIG_PROC_FS int i, j; int regnr, irq_no; struct irq_region *region; struct irqaction *action, *mainaction; seq_puts(p, " "); for (j=0; j<smp_num_cpus; j++) seq_printf(p, "CPU%d ",j); seq_putc(p, '\n'); for (regnr = 0; regnr < NR_IRQ_REGS; regnr++) { region = irq_region[regnr]; if (!region || !region->action) continue; mainaction = region->action; for (i = 0; i <= MAX_CPU_IRQ; i++) { action = mainaction++; if (!action || !action->name) continue; irq_no = IRQ_FROM_REGION(regnr) + i; seq_printf(p, "%3d: ", irq_no); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(irq_no)); #else for (j = 0; j < smp_num_cpus; j++) seq_printf(p, "%10u ", kstat.irqs[cpu_logical_map(j)][irq_no]); #endif seq_printf(p, " %14s", region->data.name ? region->data.name : "N/A"); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); } } seq_putc(p, '\n'); #if CONFIG_SMP seq_puts(p, "LOC: "); for (j = 0; j < smp_num_cpus; j++) seq_printf(p, "%10u ", apic_timer_irqs[cpu_logical_map(j)]); seq_putc(p, '\n'); #endif #endif /* CONFIG_PROC_FS */ return 0; }
int show_interrupts(struct seq_file *p, void *v) { #ifdef CONFIG_SMP int j; #endif int irq = *(loff_t *) v; struct irqaction * action; unsigned long flags; #ifdef CONFIG_SMP if (irq == 0) { seq_puts(p, " "); for_each_online_cpu(j) seq_printf(p, "CPU%d ", j); seq_putc(p, '\n'); } #endif if (irq < ACTUAL_NR_IRQS) { raw_spin_lock_irqsave(&irq_desc[irq].lock, flags); action = irq_desc[irq].action; if (!action) goto unlock; seq_printf(p, "%3d: ", irq); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(irq)); #else for_each_online_cpu(j) seq_printf(p, "%10u ", kstat_irqs_cpu(irq, j)); #endif seq_printf(p, " %14s", irq_desc[irq].chip->name); seq_printf(p, " %c%s", (action->flags & IRQF_DISABLED)?'+':' ', action->name); for (action=action->next; action; action = action->next) { seq_printf(p, ", %c%s", (action->flags & IRQF_DISABLED)?'+':' ', action->name); } seq_putc(p, '\n'); unlock: raw_spin_unlock_irqrestore(&irq_desc[irq].lock, flags); } else if (irq == ACTUAL_NR_IRQS) { #ifdef CONFIG_SMP seq_puts(p, "IPI: "); for_each_online_cpu(j) seq_printf(p, "%10lu ", cpu_data[j].ipi_count); seq_putc(p, '\n'); #endif seq_printf(p, "ERR: %10lu\n", irq_err_count); } return 0; }
void wtd_dump_irqs(unsigned int dump) { int n; if (dump) { pr_err("\nWatchdog dump irqs:\n"); pr_err("irqnr total since-last status name\n"); } for (n = 1; n < NR_IRQS; n++) { struct irqaction *act = irq_desc[n].action; if (!act && !kstat_irqs(n)) continue; if (dump) { pr_err("%5d: %10u %11u %s\n", n, kstat_irqs(n), kstat_irqs(n) - last_irqs[n], (act && act->name) ? act->name : "???"); } last_irqs[n] = kstat_irqs(n); } }
static int init_card(struct IsdnCardState *cs) { int irq_cnt, cnt = 3, ret; if (!cs->irq) { ret = cs->cardmsg(cs, CARD_INIT, NULL); return(ret); } irq_cnt = kstat_irqs(cs->irq); printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], cs->irq, irq_cnt); if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) { printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n", cs->irq); return 1; } while (cnt) { cs->cardmsg(cs, CARD_INIT, NULL); /* Timeout 10ms */ msleep(10); printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], cs->irq, kstat_irqs(cs->irq)); if (kstat_irqs(cs->irq) == irq_cnt) { printk(KERN_WARNING "%s: IRQ(%d) getting no interrupts during init %d\n", CardType[cs->typ], cs->irq, 4 - cnt); if (cnt == 1) { free_irq(cs->irq, cs); return 2; } else { cs->cardmsg(cs, CARD_RESET, NULL); cnt--; } } else { cs->cardmsg(cs, CARD_TEST, NULL); return 0; } } return 3; }
void wtd_dump_irqs(unsigned int dump) { int n; unsigned long long *t_ptr; t_ptr = MSM_IRQ_COUNT_TIMESTAMP_ADDR; *t_ptr = cpu_clock(smp_processor_id()); do_div(*t_ptr, 1000000000); if (dump) { pr_err("\nWatchdog dump irqs:\n"); pr_err("irqnr total since-last status name\n"); } for (n = 1; n < NR_IRQS; n++) { struct irqaction *act = irq_desc[n].action; if (!act && !kstat_irqs(n)) continue; if (irq_count_info_ptr && ((unsigned int *)(irq_count_info_ptr + 1) \ < (unsigned int *)(MSM_IRQ_COUNT_INFO_BASE + MSM_IRQ_COUNT_INFO_SIZE))) { if (last_irqs[n].debug_info_ptr != NULL) { (*last_irqs[n].debug_info_ptr).total = kstat_irqs(n); (*last_irqs[n].debug_info_ptr).since_last = \ (*last_irqs[n].debug_info_ptr).total - last_irqs[n].last_irqs; } else { last_irqs[n].debug_info_ptr = irq_count_info_ptr++; (*last_irqs[n].debug_info_ptr).irqnr = n; } } if (dump) { pr_err("%5d: %10u %11u %8x %s\n", n, (*last_irqs[n].debug_info_ptr).total, (*last_irqs[n].debug_info_ptr).since_last, irq_desc[n].status, (act && act->name) ? act->name : "???"); } (*irq_count_info_ptr).irqnr = 0x55AA66BB; /*IRQ state magic number*/ last_irqs[n].last_irqs = (*last_irqs[n].debug_info_ptr).total; } mb(); }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v, j; struct irqaction * action; unsigned long flags; if (i == 0) { seq_printf(p, " "); for_each_online_cpu(j) seq_printf(p, "CPU%-8d",j); seq_putc(p, '\n'); } if (i < NR_IRQS) { spin_lock_irqsave(&irq_desc[i].lock, flags); action = irq_desc[i].action; if (!action) goto skip; seq_printf(p, "%3d: ",i); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(i)); #else for_each_online_cpu(j) seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); #endif seq_printf(p, " %8s", irq_desc[i].chip->name); seq_printf(p, "-%-8s", irq_desc[i].name); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); skip: spin_unlock_irqrestore(&irq_desc[i].lock, flags); } else if (i == NR_IRQS) { seq_printf(p, "NMI: "); for_each_online_cpu(j) seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); seq_putc(p, '\n'); seq_printf(p, "LOC: "); for_each_online_cpu(j) seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs); seq_putc(p, '\n'); seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); } return 0; }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v, j; struct irq_desc *desc; struct irqaction *action; unsigned long flags; if (i == 0) { seq_printf(p, " "); for_each_online_cpu(j) seq_printf(p, "CPU%-8d", j); seq_putc(p, '\n'); } if (i < nr_irq) { desc = irq_to_desc(i); raw_spin_lock_irqsave(&desc->lock, flags); action = desc->action; if (!action) goto skip; seq_printf(p, "%3d: ", i); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(i)); #else for_each_online_cpu(j) seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); #endif seq_printf(p, " %8s", desc->status & IRQ_LEVEL ? "level" : "edge"); seq_printf(p, " %8s", desc->irq_data.chip->name); seq_printf(p, " %s", action->name); for (action = action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); skip: raw_spin_unlock_irqrestore(&desc->lock, flags); } return 0; }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v; struct irqaction * action; if (i < NR_IRQS) { action = irq_desc[i].action; if (!action) continue; seq_printf(p, "%3d: %10u ", i, kstat_irqs(i)); seq_printf(p, " %s", action->name); for (action = action->next; action; action = action->next) { seq_printf(p, ", %s", action->name); } seq_putc(p, '\n'); } else if (i == NR_IRQS) { show_fiq_list(p, v); seq_printf(p, "Err: %10lu\n", irq_err_count); } return 0; }
int show_interrupts(struct seq_file *p, void *v) { int j, i = *(loff_t *) v; struct irqaction * action; irq_desc_t *idesc; unsigned long flags; if (i == 0) { seq_puts(p, " "); for (j=0; j<NR_CPUS; j++) if (cpu_online(j)) seq_printf(p, "CPU%d ",j); seq_putc(p, '\n'); } if (i < NR_IRQS) { idesc = irq_descp(i); spin_lock_irqsave(&idesc->lock, flags); action = idesc->action; if (!action) goto skip; seq_printf(p, "%3d: ",i); #ifndef CONFIG_SMP seq_printf(p, "%10u ", kstat_irqs(i)); #else for (j = 0; j < NR_CPUS; j++) if (cpu_online(j)) seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); #endif seq_printf(p, " %14s", idesc->handler->typename); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); skip: spin_unlock_irqrestore(&idesc->lock, flags); } else if (i == NR_IRQS) {
int get_irq_list(char *buf) { int i; struct irqaction * action; char *p = buf; for (i = 0 ; i < NR_IRQS ; i++) { action = irq_desc[i].action; if (!action) continue; p += sprintf(p, "%3d: %10u ", i, kstat_irqs(i)); p += sprintf(p, " %s", action->name); for (action = action->next; action; action = action->next) { p += sprintf(p, ", %s", action->name); } *p++ = '\n'; } #ifdef CONFIG_ARCH_ACORN p += get_fiq_list(p); #endif p += sprintf(p, "Err: %10lu\n", irq_err_count); return p - buf; }
case ACCEL: accel_irq = irq; break; case COMPASS: compass_irq = irq; break; } } static ssize_t i2c_counters_show(struct class *cls, struct class_attribute *attr, char *buf) { return scnprintf(buf, PAGE_SIZE, "%ld.%03ld %u %u %u %u %u %u %u %u %u %u\n", jiffies / HZ, ((jiffies % HZ) * (1024 / HZ)), mpu_irq ? kstat_irqs(mpu_irq) : 0, Counters.i2c_tempreads, Counters.i2c_mpureads, Counters.i2c_mpuwrites, accel_irq ? kstat_irqs(accel_irq) : Counters.i2c_accelirq, Counters.i2c_accelreads, Counters.i2c_accelwrites, compass_irq ? kstat_irqs(compass_irq) : Counters.i2c_compassirq, Counters.i2c_compassreads, Counters.i2c_compasswrites); } void inv_iio_counters_tempread(int count) { Counters.i2c_tempreads += count; } EXPORT_SYMBOL_GPL(inv_iio_counters_tempread); void inv_iio_counters_mpuread(int count)
static int show_stat(struct seq_file *p, void *v) { int i, j; unsigned long jif; u64 user, nice, system, idle, iowait, irq, softirq, steal; u64 guest, guest_nice; u64 sum = 0; u64 sum_softirq = 0; unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; struct timespec boottime; user = nice = system = idle = iowait = irq = softirq = steal = 0; guest = guest_nice = 0; getboottime(&boottime); jif = boottime.tv_sec; for_each_possible_cpu(i) { user += kcpustat_cpu(i).cpustat[CPUTIME_USER]; nice += kcpustat_cpu(i).cpustat[CPUTIME_NICE]; system += kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; idle += get_idle_time(i); iowait += get_iowait_time(i); irq += kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; softirq += kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; steal += kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; guest += kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; guest_nice += kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; sum += kstat_cpu_irqs_sum(i); sum += arch_irq_stat_cpu(i); for (j = 0; j < NR_SOFTIRQS; j++) { unsigned int softirq_stat = kstat_softirqs_cpu(j, i); per_softirq_sums[j] += softirq_stat; sum_softirq += softirq_stat; } } sum += arch_irq_stat(); seq_puts(p, "cpu "); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice)); seq_putc(p, '\n'); for_each_online_cpu(i) { /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; nice = kcpustat_cpu(i).cpustat[CPUTIME_NICE]; system = kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]; idle = get_idle_time(i); iowait = get_iowait_time(i); irq = kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; softirq = kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]; steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; seq_printf(p, "cpu%d", i); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest)); seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice)); seq_putc(p, '\n'); } seq_printf(p, "intr %llu", (unsigned long long)sum); /* sum again ? it could be updated? */ for_each_irq_nr(j) seq_put_decimal_ull(p, ' ', kstat_irqs(j)); seq_printf(p, "\nctxt %llu\n" "btime %lu\n" "processes %lu\n" "procs_running %lu\n" "procs_blocked %lu\n", nr_context_switches(), (unsigned long)jif, total_forks, nr_running(), nr_iowait()); seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); for (i = 0; i < NR_SOFTIRQS; i++) seq_put_decimal_ull(p, ' ', per_softirq_sums[i]); seq_putc(p, '\n'); return 0; }
static DECLARE_WAIT_QUEUE_HEAD(WaitQueue); static DECLARE_WAIT_QUEUE_HEAD(WaitEnd); struct task_struct *holding[64], *p, *q; int hold_no = 0; int end_relaxer = 0; int ending = 0; bool taken[64]; long threshold = 0.10; //long's are integers!!! C casting is done by my_float = (float)my_long; /* Pretty much problems will come from: Casting Pointers */ int irq_old = kstat_irqs(1); int irq_new; while (1){ irq_new = kstat_irqs(1) + 1; if ((irq_new - irq_old) > 0){ p = &init_task; q = &init_task; p = next_task(p); while (p->pid != q->pid){ // maybe try greater than? or try *p->pid
static int kstat_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { int i, len = 0; extern unsigned long total_forks; unsigned long jif = jiffies; unsigned int sum = 0, user = 0, nice = 0, system = 0; int major, disk; for (i = 0 ; i < smp_num_cpus; i++) { int cpu = cpu_logical_map(i), j; user += kstat.per_cpu_user[cpu]; nice += kstat.per_cpu_nice[cpu]; system += kstat.per_cpu_system[cpu]; #if !defined(CONFIG_ARCH_S390) for (j = 0 ; j < NR_IRQS ; j++) sum += kstat.irqs[cpu][j]; #endif } proc_sprintf(page, &off, &len, "cpu %u %u %u %lu\n", user, nice, system, jif * smp_num_cpus - (user + nice + system)); for (i = 0 ; i < smp_num_cpus; i++) proc_sprintf(page, &off, &len, "cpu%d %u %u %u %lu\n", i, kstat.per_cpu_user[cpu_logical_map(i)], kstat.per_cpu_nice[cpu_logical_map(i)], kstat.per_cpu_system[cpu_logical_map(i)], jif - ( kstat.per_cpu_user[cpu_logical_map(i)] \ + kstat.per_cpu_nice[cpu_logical_map(i)] \ + kstat.per_cpu_system[cpu_logical_map(i)])); proc_sprintf(page, &off, &len, "page %u %u\n" "swap %u %u\n" "intr %u", kstat.pgpgin >> 1, kstat.pgpgout >> 1, kstat.pswpin, kstat.pswpout, sum ); #if !defined(CONFIG_ARCH_S390) && !defined(CONFIG_ALPHA) for (i = 0 ; i < NR_IRQS ; i++) proc_sprintf(page, &off, &len, " %u", kstat_irqs(i)); #endif proc_sprintf(page, &off, &len, "\ndisk_io: "); for (major = 0; major < DK_MAX_MAJOR; major++) { for (disk = 0; disk < DK_MAX_DISK; disk++) { int active = kstat.dk_drive[major][disk] + kstat.dk_drive_rblk[major][disk] + kstat.dk_drive_wblk[major][disk]; if (active) proc_sprintf(page, &off, &len, "(%u,%u):(%u,%u,%u,%u,%u) ", major, disk, kstat.dk_drive[major][disk], kstat.dk_drive_rio[major][disk], kstat.dk_drive_rblk[major][disk], kstat.dk_drive_wio[major][disk], kstat.dk_drive_wblk[major][disk] ); } } proc_sprintf(page, &off, &len, "\nctxt %u\n" "btime %lu\n" "processes %lu\n", kstat.context_swtch, xtime.tv_sec - jif / HZ, total_forks); return proc_calc_metrics(page, start, off, count, eof, len); }
int show_interrupts(struct seq_file *p, void *v) { int i = *(loff_t *) v, j; unsigned long flags; if (i == 0) { seq_puts(p, " "); for_each_online_cpu(j) seq_printf(p, " CPU%d", j); #ifdef PARISC_IRQ_CR16_COUNTS seq_printf(p, " [min/avg/max] (CPU cycle counts)"); #endif seq_putc(p, '\n'); } if (i < NR_IRQS) { struct irqaction *action; atomic_spin_lock_irqsave(&irq_desc[i].lock, flags); action = irq_desc[i].action; if (!action) goto skip; seq_printf(p, "%3d: ", i); #ifdef CONFIG_SMP for_each_online_cpu(j) seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); #else seq_printf(p, "%10u ", kstat_irqs(i)); #endif seq_printf(p, " %14s", irq_desc[i].chip->typename); #ifndef PARISC_IRQ_CR16_COUNTS seq_printf(p, " %s", action->name); while ((action = action->next)) seq_printf(p, ", %s", action->name); #else for ( ;action; action = action->next) { unsigned int k, avg, min, max; min = max = action->cr16_hist[0]; for (avg = k = 0; k < PARISC_CR16_HIST_SIZE; k++) { int hist = action->cr16_hist[k]; if (hist) { avg += hist; } else break; if (hist > max) max = hist; if (hist < min) min = hist; } avg /= k; seq_printf(p, " %s[%d/%d/%d]", action->name, min,avg,max); } #endif seq_putc(p, '\n'); skip: atomic_spin_unlock_irqrestore(&irq_desc[i].lock, flags); } return 0; }
static int show_stat(struct seq_file *p, void *v) { int i, j; unsigned long jif; cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; cputime64_t guest, guest_nice; u64 sum = 0; u64 sum_softirq = 0; unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; struct timespec boottime; user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; guest = guest_nice = cputime64_zero; getboottime(&boottime); jif = boottime.tv_sec; for_each_possible_cpu(i) { user = cputime64_add(user, kstat_cpu(i).cpustat.user); nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); system = cputime64_add(system, kstat_cpu(i).cpustat.system); idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle); idle = cputime64_add(idle, arch_idle_time(i)); iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait); irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); guest_nice = cputime64_add(guest_nice, kstat_cpu(i).cpustat.guest_nice); sum += kstat_cpu_irqs_sum(i); sum += arch_irq_stat_cpu(i); for (j = 0; j < NR_SOFTIRQS; j++) { unsigned int softirq_stat = kstat_softirqs_cpu(j, i); per_softirq_sums[j] += softirq_stat; sum_softirq += softirq_stat; } } sum += arch_irq_stat(); seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu" "%llu\n", (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice), (unsigned long long)cputime64_to_clock_t(system), (unsigned long long)cputime64_to_clock_t(idle), (unsigned long long)cputime64_to_clock_t(iowait), (unsigned long long)cputime64_to_clock_t(irq), (unsigned long long)cputime64_to_clock_t(softirq), (unsigned long long)cputime64_to_clock_t(steal), (unsigned long long)cputime64_to_clock_t(guest), (unsigned long long)cputime64_to_clock_t(guest_nice)); for_each_online_cpu(i) { /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ user = kstat_cpu(i).cpustat.user; nice = kstat_cpu(i).cpustat.nice; system = kstat_cpu(i).cpustat.system; idle = kstat_cpu(i).cpustat.idle; idle = cputime64_add(idle, arch_idle_time(i)); iowait = kstat_cpu(i).cpustat.iowait; irq = kstat_cpu(i).cpustat.irq; softirq = kstat_cpu(i).cpustat.softirq; steal = kstat_cpu(i).cpustat.steal; guest = kstat_cpu(i).cpustat.guest; guest_nice = kstat_cpu(i).cpustat.guest_nice; seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu" "%llu\n", i, (unsigned long long)cputime64_to_clock_t(user), (unsigned long long)cputime64_to_clock_t(nice), (unsigned long long)cputime64_to_clock_t(system), (unsigned long long)cputime64_to_clock_t(idle), (unsigned long long)cputime64_to_clock_t(iowait), (unsigned long long)cputime64_to_clock_t(irq), (unsigned long long)cputime64_to_clock_t(softirq), (unsigned long long)cputime64_to_clock_t(steal), (unsigned long long)cputime64_to_clock_t(guest), (unsigned long long)cputime64_to_clock_t(guest_nice)); } seq_printf(p, "intr %llu", (unsigned long long)sum); /* sum again ? it could be updated? */ for_each_irq_nr(j) seq_printf(p, " %u", kstat_irqs(j)); seq_printf(p, "\nctxt %llu\n" "btime %lu\n" "processes %lu\n" "procs_running %lu\n" "procs_blocked %lu\n", nr_context_switches(), (unsigned long)jif, total_forks, nr_running(), nr_iowait()); seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); for (i = 0; i < NR_SOFTIRQS; i++) seq_put_decimal_ull(p, ' ', per_softirq_sums[i]); seq_putc(p, '\n'); return 0; }
int get_irq_list(char *buf) { #ifdef CONFIG_PROC_FS char *p = buf; int i, j; int regnr, irq_no; struct irq_region *region; struct irqaction *action, *mainaction; p += sprintf(p, " "); for (j=0; j<smp_num_cpus; j++) p += sprintf(p, "CPU%d ",j); *p++ = '\n'; for (regnr = 0; regnr < NR_IRQ_REGS; regnr++) { region = irq_region[regnr]; if (!region || !region->action) continue; mainaction = region->action; for (i = 0; i <= MAX_CPU_IRQ; i++) { action = mainaction++; if (!action || !action->name) continue; irq_no = IRQ_FROM_REGION(regnr) + i; p += sprintf(p, "%3d: ", irq_no); #ifndef CONFIG_SMP p += sprintf(p, "%10u ", kstat_irqs(irq_no)); #else for (j = 0; j < smp_num_cpus; j++) p += sprintf(p, "%10u ", kstat.irqs[cpu_logical_map(j)][irq_no]); #endif p += sprintf(p, " %14s", region->data.name ? region->data.name : "N/A"); p += sprintf(p, " %s", action->name); for (action=action->next; action; action = action->next) p += sprintf(p, ", %s", action->name); *p++ = '\n'; } } p += sprintf(p, "\n"); #if CONFIG_SMP p += sprintf(p, "LOC: "); for (j = 0; j < smp_num_cpus; j++) p += sprintf(p, "%10u ", apic_timer_irqs[cpu_logical_map(j)]); p += sprintf(p, "\n"); #endif return p - buf; #else /* CONFIG_PROC_FS */ return 0; #endif /* CONFIG_PROC_FS */ }