Thread: [Compbench-devel] CompBenchmarks++/System System-FreeBSD.cpp, 1.5, 1.6 System-Linux.cpp, 1.4, 1.5 S
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2006-11-01 10:32:20
|
Update of /cvsroot/compbench/CompBenchmarks++/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18917 Modified Files: System-FreeBSD.cpp System-Linux.cpp System-Unix.cpp Log Message: Chomp() used : strings from system() call are now given without any trailling \n or \r. Index: System-FreeBSD.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-FreeBSD.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** System-FreeBSD.cpp 26 Sep 2006 16:03:14 -0000 1.5 --- System-FreeBSD.cpp 1 Nov 2006 10:32:17 -0000 1.6 *************** *** 19,38 **** std::string CBMSystemFreeBSD::processor_name(void) { ! return(exec0("echo $(/sbin/sysctl hw.model | head -1 | cut -f2 -d'=')")); } std::string CBMSystemFreeBSD::processor_mhz(void) { ! return(exec0("echo $(/sbin/sysctl hw.cpuspeed | head -1 | cut -f2 -d'=')")); } std::string CBMSystemFreeBSD::processor_cache(void) { ! return(exec0("echo $(/sbin/sysctl hw.l2cachesize 2> /dev/null | head -1 | cut -f2 -d'=')")); } std::string CBMSystemFreeBSD::processor_number(void) { ! return(exec0("echo $(/sbin/sysctl hw.ncpu | head -1 | cut -f2 -d'=')")); } --- 19,51 ---- std::string CBMSystemFreeBSD::processor_name(void) { ! std::string r = exec0("echo $(/sbin/sysctl hw.model | head -1 | cut -f2 -d'=')"); ! ! Chomp(r); ! ! return(r); } std::string CBMSystemFreeBSD::processor_mhz(void) { ! std::string r = exec0("echo $(/sbin/sysctl hw.cpuspeed | head -1 | cut -f2 -d'=')"); ! Chomp(r); ! ! return(r); } std::string CBMSystemFreeBSD::processor_cache(void) { ! std::string r = exec0("echo $(/sbin/sysctl hw.l2cachesize 2> /dev/null | head -1 | cut -f2 -d'=')"); ! Chomp(r); ! ! return(r); } std::string CBMSystemFreeBSD::processor_number(void) { ! std::string r = exec0("echo $(/sbin/sysctl hw.ncpu | head -1 | cut -f2 -d'=')"); ! Chomp(r); ! ! return(r); } Index: System-Unix.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Unix.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** System-Unix.cpp 3 Oct 2006 15:46:56 -0000 1.4 --- System-Unix.cpp 1 Nov 2006 10:32:17 -0000 1.5 *************** *** 73,77 **** std::string CBMSystemUnix::arch(void) { ! return(exec0("uname -m 2> /dev/null")); } --- 73,79 ---- std::string CBMSystemUnix::arch(void) { ! std::string r = exec0("uname -m 2> /dev/null"); ! Chomp(r); ! return(r); } *************** *** 79,98 **** std::string CBMSystemUnix::hostid(void) { ! return(exec0("hostid 2> /dev/null")); } std::string CBMSystemUnix::hostname(void) { ! return(exec0("hostname 2> /dev/null")); } std::string CBMSystemUnix::os(void) { ! return(exec0("uname 2> /dev/null")); } std::string CBMSystemUnix::os_version(void) { ! return(exec0("uname -r 2> /dev/null")); } --- 81,111 ---- std::string CBMSystemUnix::hostid(void) { ! std::string r = exec0("hostid 2> /dev/null"); ! Chomp(r); ! return(r); } std::string CBMSystemUnix::hostname(void) { ! std::string r = exec0("hostname 2> /dev/null"); ! Chomp(r); ! ! return(r); } std::string CBMSystemUnix::os(void) { ! std::string r = exec0("uname 2> /dev/null"); ! ! Chomp(r); ! return(r); } std::string CBMSystemUnix::os_version(void) { ! std::string r = exec0("uname -r 2> /dev/null"); ! Chomp(r); ! ! return(r); } Index: System-Linux.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Linux.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** System-Linux.cpp 26 Sep 2006 16:03:15 -0000 1.4 --- System-Linux.cpp 1 Nov 2006 10:32:17 -0000 1.5 *************** *** 19,38 **** std::string CBMSystemLinux::processor_name(void) { ! return(exec0("cat /proc/cpuinfo | grep 'model name' | head -1 | cut -f2 -d':' | sed 's/^ //' 2> /dev/null")); } std::string CBMSystemLinux::processor_mhz(void) { ! return(exec0("(cat /proc/cpuinfo | grep 'cpu MHz' | head -1 | cut -f2 -d':' | sed 's/^ //' | cut -f1 -d'.') 2> /dev/null")); } std::string CBMSystemLinux::processor_cache(void) { ! return(exec0("(cat /proc/cpuinfo | grep 'cache size' | head -1 | cut -f2 -d':' | sed 's/^ //' | sed 's/KB//') 2> /dev/null")); } std::string CBMSystemLinux::processor_number(void) { ! return(exec0("(cat /proc/cpuinfo | grep 'model name' | wc -l) 2> /dev/null")); } --- 19,52 ---- std::string CBMSystemLinux::processor_name(void) { ! std::string r; ! ! r=exec0("cat /proc/cpuinfo | grep 'model name' | head -1 | cut -f2 -d':' | sed 's/^ //' 2> /dev/null"); ! Chomp(r); ! ! return(r); } std::string CBMSystemLinux::processor_mhz(void) { ! std::string r = exec0("(cat /proc/cpuinfo | grep 'cpu MHz' | head -1 | cut -f2 -d':' | sed 's/^ //' | cut -f1 -d'.') 2> /dev/null"); ! ! Chomp(r); ! ! return(r); } std::string CBMSystemLinux::processor_cache(void) { ! std::string r = exec0("(cat /proc/cpuinfo | grep 'cache size' | head -1 | cut -f2 -d':' | sed 's/^ //' | sed 's/KB//') 2> /dev/null"); ! Chomp(r); ! ! return(r); } std::string CBMSystemLinux::processor_number(void) { ! std::string r = exec0("(cat /proc/cpuinfo | grep 'model name' | wc -l) 2> /dev/null"); ! Chomp(r); ! return(r); } |