Bernard Li wrote: > 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 > # Collect the number of CPUs. > 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? >
Hi Bernard, maybe you can quickly resolve in this way: if [ -z "$cpu" ]; then cpu=$(echo `cat /proc/cpuinfo | grep "model name\|cpu MHz" | sed -ne '1,2p' | 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=$((`cat /proc/cpuinfo | grep "^processor" | sed -n '$p' | sed "s/.*: \([0-9]\)*$/\1/"` + 1)) fi but anyway I've no objection including head and wc in busybox... Cheers, -Andrea ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Sisuite-devel mailing list Sisuite-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sisuite-devel