Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mpc: optimize HZ retrieval

As Brian De Wolf noted:

hz only really needs to be calculated once, so this line could be
moved up out of the loop, resulting in a likely unnoticeable
performance increase. :)
  • Loading branch information...
commit c7f80a0c4b82d9977add2d5bbda355247cdf6ffe 1 parent 7164a0e
@steveschnepp steveschnepp authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  tools/munin-plugins-busybox/cpu.c
View
2  tools/munin-plugins-busybox/cpu.c
@@ -136,8 +136,8 @@ int cpu(int argc, char **argv) {
}
if(!(f=fopen(PROC_STAT, "r")))
return fail("cannot open " PROC_STAT);
+ hz = getenvint("HZ", 100);
while(fgets(buff, 256, f)) {
- hz = getenvint("HZ", 100);
if(!strncmp(buff, "cpu ", 4)) {
fclose(f);
if(!(s = strtok(buff+4, " \t")))
Please sign in to comment.
Something went wrong with that request. Please try again.