Currently there is a bug with si_monitor with displaying
the CPU info with dual core machines. On a 2 socket dualcore server, the
CPU info will be displayed 4 times.
I would also like to add another
field to si_monitortk such that it displays the number of CPUs on the
server.
The following are code snippets for
funcions:
if [ -z "$cpu" ];
then
cpu=$(echo `cat /proc/cpuinfo | grep "model name\|cpu MHz" | head -n 2 | sed "s/.*: //" | sed "s/^\([0-9\.]*\)$/(\1 MHz)/"` | sed "s/\(MHz)\)/\1 |/g" | sed "s/ |$//")
fi
cpu=$(echo `cat /proc/cpuinfo | grep "model name\|cpu MHz" | head -n 2 | sed "s/.*: //" | sed "s/^\([0-9\.]*\)$/(\1 MHz)/"` | sed "s/\(MHz)\)/\1 |/g" | sed "s/ |$//")
fi
# Collect the number of
CPUs.
if [ -z "$ncpus" ]; then
ncpus=$(echo `cat /proc/cpuinfo | grep "processor" | wc -l`)
fi
if [ -z "$ncpus" ]; then
ncpus=$(echo `cat /proc/cpuinfo | grep "processor" | wc -l`)
fi
head and wc are not present and I
need to compile them in - any objections to that?
I could replace wc -l with a grep -c
but the -c functionality is only available in BusyBox 1.1.0-pre1.
I plan to put the bugfix in branch
and both code changes into trunk.
I'd like to hear what you guys think
is the best approach.
Cheers,
Bernard