Messages in this thread | | | Subject | Re: [PATCH v2] proc: speedup /proc/stat handling | From | Eric Dumazet <> | Date | Fri, 27 Jan 2012 08:09:07 +0100 |
| |
Le vendredi 27 janvier 2012 à 10:09 +0900, KAMEZAWA Hiroyuki a écrit : > On Thu, 26 Jan 2012 16:43:42 -0800 > Andrew Morton <akpm@linux-foundation.org> wrote: > > > > > I expect most of these numbers are zero. I wonder if we would get > > useful speedups from > > > > for_each_irq_nr(j) { > > /* Apologetic comment goes here */ > > if (kstat_irqs(j)) > > seq_printf(p, " %u", kstat_irqs(j)); > > else > > seq_puts(p, " 0"); > > } > > Yes. This is very good optimization and shows much optimization. > I did this at first try but did complicated ones because it seems > not interesting. (This is my bad habit...) > > I'll try again and measure time. >
Also make it generic maybe, and evaluate kstat_irqs(i) once.
seq_put_u32(struct seq_file *m, u32 val);
Converting an "u32" to its decimal representation should be fast, even for non zero values. Many other users could benefit from this.
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |