Thread: [Compbench-devel] CompBenchmarks++/System System.cpp, 1.20, 1.21 System-Cygwin.cpp, 1.3, 1.4 System
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-18 18:43:09
|
Update of /cvsroot/compbench/CompBenchmarks++/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18241 Modified Files: System.cpp System-Cygwin.cpp System-Cygwin.h System-FreeBSD.cpp System-FreeBSD.h System.h System-Linux.cpp System-Linux.h System-Unix.cpp System-Unix.h XML.cpp XML.h Log Message: CBM namespace. Index: XML.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/XML.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XML.cpp 17 Jan 2007 19:08:35 -0000 1.1 --- XML.cpp 18 Jan 2007 18:43:02 -0000 1.2 *************** *** 8,13 **** #include <System/XML.h> ! CBMXMLAttribute::CBMXMLAttribute(std::string _name, std::string _value) { --- 8,14 ---- #include <System/XML.h> + using namespace CBM::XML; ! Attribute::Attribute(std::string _name, std::string _value) { *************** *** 16,40 **** } ! std::string CBMXMLAttribute::Name(void) { return(name); } ! std::string CBMXMLAttribute::Value(void) { return(value); } ! void CBMXMLAttribute::setValue(std::string _value) { value=_value; } ! CBMXMLAttribute::~CBMXMLAttribute() { } ! CBMXMLNode::CBMXMLNode(std::string _name, ! std::string _value) { name=_name; --- 17,41 ---- } ! std::string Attribute::Name(void) { return(name); } ! std::string Attribute::Value(void) { return(value); } ! void Attribute::setValue(std::string _value) { value=_value; } ! Attribute::~Attribute() { } ! Node::Node(std::string _name, ! std::string _value) { name=_name; *************** *** 42,46 **** } ! void CBMXMLNode::indent(std::string& str, int _indent) { --- 43,47 ---- } ! void Node::indent(std::string& str, int _indent) { *************** *** 49,83 **** } ! std::string CBMXMLNode::Name(void) { return(name); } ! std::string CBMXMLNode::Value(void) { return(value); } ! void CBMXMLNode::setValue(std::string _value) { value=_value; } ! int CBMXMLNode::childNumber(void) { return(childs.size()); } ! CBMXMLNode *CBMXMLNode::getChild(int _index) { return(childs[_index]); } ! int CBMXMLNode::attributeNumber(void) { return(attributes.size()); } ! CBMXMLAttribute *CBMXMLNode::getAttribute(int _index) { return(attributes[_index]); --- 50,84 ---- } ! std::string Node::Name(void) { return(name); } ! std::string Node::Value(void) { return(value); } ! void Node::setValue(std::string _value) { value=_value; } ! int Node::childNumber(void) { return(childs.size()); } ! Node *Node::getChild(int _index) { return(childs[_index]); } ! int Node::attributeNumber(void) { return(attributes.size()); } ! Attribute *Node::getAttribute(int _index) { return(attributes[_index]); *************** *** 85,89 **** ! CBMXMLNode *CBMXMLNode::add(CBMXMLNode *_child) { childs.push_back(_child); --- 86,90 ---- ! Node *Node::add(Node *_child) { childs.push_back(_child); *************** *** 91,103 **** } ! CBMXMLNode *CBMXMLNode::addNode(std::string _name, std::string _value) { ! CBMXMLNode *result = new CBMXMLNode(_name, _value); return(add(result)); } ! CBMXMLAttribute *CBMXMLNode::add(CBMXMLAttribute *_attribute) { attributes.push_back(_attribute); --- 92,104 ---- } ! Node *Node::addNode(std::string _name, std::string _value) { ! Node *result = new Node(_name, _value); return(add(result)); } ! Attribute *Node::add(Attribute *_attribute) { attributes.push_back(_attribute); *************** *** 105,120 **** } ! CBMXMLAttribute *CBMXMLNode::addAttribute(std::string _name, std::string _value) { ! CBMXMLAttribute *result = new CBMXMLAttribute(_name, _value); return(add(result)); } ! std::string CBMXMLNode::str(int _indent) { std::string result; ! CBMXMLAttribute *att; int i; int n_child; --- 106,121 ---- } ! Attribute *Node::addAttribute(std::string _name, std::string _value) { ! Attribute *result = new Attribute(_name, _value); return(add(result)); } ! std::string Node::str(int _indent) { std::string result; ! Attribute *att; int i; int n_child; *************** *** 172,176 **** } ! CBMXMLNode::~CBMXMLNode() { } --- 173,177 ---- } ! Node::~Node() { } Index: System-Cygwin.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Cygwin.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** System-Cygwin.cpp 1 Nov 2006 10:31:17 -0000 1.3 --- System-Cygwin.cpp 18 Jan 2007 18:43:02 -0000 1.4 *************** *** 12,17 **** #include <config.h> /* !!! */ ! CBMSystemCygwin::CBMSystemCygwin() ! : CBMSystemUnix() { std::string cmd = "cscript.exe /nologo systemInfo.wmi"; --- 12,17 ---- #include <config.h> /* !!! */ ! SystemCygwin::SystemCygwin() ! : SystemUnix() { std::string cmd = "cscript.exe /nologo systemInfo.wmi"; *************** *** 19,23 **** } ! std::string CBMSystemCygwin::processor_name(void) { std::string r = Split(cache, "\n", 2); --- 19,23 ---- } ! std::string SystemCygwin::processor_name(void) { std::string r = Split(cache, "\n", 2); *************** *** 27,31 **** } ! std::string CBMSystemCygwin::processor_mhz(void) { std::string r = Split(cache, "\n", 0); --- 27,31 ---- } ! std::string SystemCygwin::processor_mhz(void) { std::string r = Split(cache, "\n", 0); *************** *** 35,39 **** } ! std::string CBMSystemCygwin::processor_cache(void) { std::string r = Split(cache, "\n", 1); --- 35,39 ---- } ! std::string SystemCygwin::processor_cache(void) { std::string r = Split(cache, "\n", 1); *************** *** 43,47 **** } ! std::string CBMSystemCygwin::processor_number(void) { std::string r = Split(cache, "\n", 3); --- 43,47 ---- } ! std::string SystemCygwin::processor_number(void) { std::string r = Split(cache, "\n", 3); *************** *** 51,55 **** } ! CBMSystemCygwin::~CBMSystemCygwin() { } --- 51,55 ---- } ! SystemCygwin::~SystemCygwin() { } Index: System-Cygwin.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Cygwin.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** System-Cygwin.h 1 Nov 2006 10:30:53 -0000 1.2 --- System-Cygwin.h 18 Jan 2007 18:43:02 -0000 1.3 *************** *** 12,54 **** #include <System/System-Unix.h> ! /** \brief Cygwin operating system support class. ! * ! * Implements a few methods not defined by CBMSystemUnix to handle properly ! * Cygwin systems in CompBenchmarks. ! */ ! class CBMSystemCygwin : public CBMSystemUnix ! { ! private: ! std::string cache; ! protected: ! public: ! /** Constructor */ ! CBMSystemCygwin(); ! /** Returns processor name ! * Uses WMI to get the name of the first installed processor. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void); ! /** Returns processor speed ! * Uses WMI to get the speed, in MHz, of the first installed processor. ! * \return Processor speed in MHz, as clear text (integer returned) ! * \sa processor_number() */ ! virtual std::string processor_mhz(void); ! /** Returns processor cache ! * Uses WMI to get processor second level cache in Kb. Integer expected. ! * \return std::string coding (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void); ! /** Returns processors' number ! * Uses WMI to get information. ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void); ! /** Virtual destructor */ ! virtual ~CBMSystemCygwin(); ! }; #endif --- 12,56 ---- #include <System/System-Unix.h> ! namespace CBM { ! /** \brief Cygwin operating system support class. ! * ! * Implements a few methods not defined by SystemUnix to handle properly ! * Cygwin systems in CompBenchmarks. ! */ ! class SystemCygwin : public SystemUnix ! { ! private: ! std::string cache; ! protected: ! public: ! /** Constructor */ ! SystemCygwin(); ! /** Returns processor name ! * Uses WMI to get the name of the first installed processor. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void); ! /** Returns processor speed ! * Uses WMI to get the speed, in MHz, of the first installed processor. ! * \return Processor speed in MHz, as clear text (integer returned) ! * \sa processor_number() */ ! virtual std::string processor_mhz(void); ! /** Returns processor cache ! * Uses WMI to get processor second level cache in Kb. Integer expected. ! * \return std::string coding (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void); ! /** Returns processors' number ! * Uses WMI to get information. ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void); ! /** Virtual destructor */ ! virtual ~SystemCygwin(); ! }; ! } #endif Index: System-Linux.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Linux.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** System-Linux.cpp 1 Nov 2006 10:32:17 -0000 1.5 --- System-Linux.cpp 18 Jan 2007 18:43:02 -0000 1.6 *************** *** 12,21 **** #include <config.h> /* !!! */ ! CBMSystemLinux::CBMSystemLinux() ! : CBMSystemUnix() { } ! std::string CBMSystemLinux::processor_name(void) { std::string r; --- 12,23 ---- #include <config.h> /* !!! */ ! using namespace CBM; ! ! SystemLinux::SystemLinux() ! : SystemUnix() { } ! std::string SystemLinux::processor_name(void) { std::string r; *************** *** 27,31 **** } ! 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"); --- 29,33 ---- } ! std::string SystemLinux::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"); *************** *** 36,40 **** } ! 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"); --- 38,42 ---- } ! std::string SystemLinux::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"); *************** *** 44,48 **** } ! std::string CBMSystemLinux::processor_number(void) { std::string r = exec0("(cat /proc/cpuinfo | grep 'model name' | wc -l) 2> /dev/null"); --- 46,50 ---- } ! std::string SystemLinux::processor_number(void) { std::string r = exec0("(cat /proc/cpuinfo | grep 'model name' | wc -l) 2> /dev/null"); *************** *** 51,55 **** } ! CBMSystemLinux::~CBMSystemLinux() { } --- 53,57 ---- } ! SystemLinux::~SystemLinux() { } Index: System.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** System.h 15 Jan 2007 17:59:14 -0000 1.20 --- System.h 18 Jan 2007 18:43:02 -0000 1.21 *************** *** 15,301 **** #include <time.h> ! ! /** Defines a vector of packages. ! */ ! typedef std::vector<std::string> PackageVector; ! ! /** \brief Operating system (and optionnaly hardware) abstraction layer. ! * ! * This class defines the base abstract (pure) object for all supported operating ! * systems. It may also introduces hardware-related dependencies. ! */ ! class CBMSystem ! { ! public: ! /** Temporary directory. ! * Defines typedef used to query temporary directories used by CompBenchmarks. */ ! typedef enum Temp { Root, /*!< Root directory */ ! HostDep, /*!< Prefix for host-dependend directory */ ! Extract, /*!< Archive extraction temporary directory */ ! Patches, /*!< Directory holding patches */ ! System, /*!< System specific material */ ! Download, /*!< Downloads temporary directory */ ! Status, /*!< Directory holding status of packages and ! * benchmarks */ ! Configuration /*!< Directory for configuration related ! * informations */ ! }; ! private: ! /** Check if the given directory holds patches. ! * Check if given arguments holds patches needed by libcompbenchmarks. ! * \param dir directory to check ! * \return non-null if ok. */ ! virtual int verifyPatchDirectory(std::string dir); ! protected: ! /** \sa Packages() */ ! PackageVector packages; ! /** Stores the last (shell) command executed by compbenchmarks library. */ ! std::string lastCommand; ! /** Stores the output of the last (shell) command executed by ! * compbenchmarks library. */ ! std::string lastCommandOutput; ! /** Constructor. */ ! CBMSystem(); ! /** Virtual destructor */ ! virtual ~CBMSystem(); ! /** External command execution. ! * Uses shell to execute command. ! * \param command shell command to execute ! * \return stdout dump ! * \sa exec() ! */ ! virtual std::string exec0(std::string& command); ! virtual std::string exec0(char *command); ! /** Returns host's architecture. ! * As uname -m on UNIX. ! * \return Host's architecture ! */ ! virtual std::string arch(void) = 0; ! /** Get host ID ! * As hostid command does on UNIX. ! * \return Host ID as string.*/ ! virtual std::string hostid(void) = 0; ! /** Returns hostname ! * Returns the shortname. ! * \return hostname */ ! virtual std::string hostname(void) = 0; ! /** Returns operating system name ! * \return Operating system name (as uname command on UNIX) */ ! virtual std::string os(void) = 0; ! /** Returns operating system version ! * \return Operating system version (as uname -r command on most UNIXes) */ ! virtual std::string os_version(void) = 0; ! /** Returns processor name ! * Here we infer that each processor on the node are identical, which is the case ! * on x86 and compatible hardware. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void) = 0; ! /** Returns processor speed ! * Processor speed in MHz. Integer expected. ! * \return std::string coding an integer matching the (first) processor speed, in MHz. */ ! virtual std::string processor_mhz(void) = 0; ! /** Returns processor cache ! * Processor second level cache in Kb. Integer expected. ! * \return std::string coding the (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void) = 0; ! /** Returns processors' number ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void) = 0; ! /** Checks a given directory. ! Directory is given according to its purpose in CompBenchmarks. ! \sa Temp ! \sa checkDirectory() ! \return 1 if ok. ! */ ! virtual int CheckDirectory(Temp where); ! public: ! /** Initialize for CompBenchmarks usage. ! * Checks for temporary directories. ! * \return 1 if ok. ! * \sa CheckDirectory() ! */ ! virtual int init(void); ! /** Give a list containing the compatible benchmarks ! * in declared directories. ! * \return a std::string list of benchmarks (id) ! * \sa Package() */ ! virtual PackageVector& packageList(int _force = 0); ! /** Get supported packages' number ! * \return integer ! * \sa Package() */ ! virtual int packageNumber(void); ! /** Get a package according to its index ! * \return CBMPackage instance ! * \sa packageNumber() ! */ ! virtual class CBMPackage *Package(int index); ! /** Get a package acoording to its internal identifier ! * \param pid std::string containing the package's identifier ! * \return CBMPackage instance ! * \sa packageList() ! */ ! virtual class CBMPackage *Package(std::string pid); ! /** Get a benchmark according to its internal identifier ! * \param bid std:string containing the benchmark's identifier ! * \return CBMBenchmark instance */ ! virtual class CBMBenchmark *Benchmark(std::string bid); ! /** Display informations about all packages ! * Used by compbenchmarks-core */ ! virtual void displayAllPackages(void); ! /** Display informations about all benchmarks ! * Used by compbenchmarks-core */ ! virtual void displayAllBenchmarks(void); ! /** Split a std::string. ! * Split given string as sub-strings, according to an arbitrary delimiter. ! * \param str string to split ! * \param delim delimiter ! * \param wantedIndex sub-string index */ ! virtual std::string Split(const std::string& str, ! const std::string& delim, ! unsigned int wantedIndex); ! /** Remove trailing line-feed (and carriage return) from specified string. ! * \param str the string */ ! virtual void Chomp(std::string& str); ! /** Describe host. ! * Displays informations about processors, OS, and so on. ! */ ! virtual void display(void); ! /** Describe external programs. ! * Displays informations about external programs used in CompBenchmarks or in ! * compbenchmark-config program. */ ! virtual void displayPrograms(void); ! /** External command execution. ! * Uses shell to execute command. ! * \param command shell command to execute ! * \param result stdout dump ! * \return return code of the shell command ! */ ! virtual int exec(std::string& command, std::string& result) = 0; ! /** Computes MD5 from a string ! * \param data Data to checksum ! * \return std::string coding data's checksum */ ! virtual std::string md5(std::string& data); ! /** Computes MD5 from a file ! * \param filename absolute filename ! * \return MD5 of the file passed. May be NULL (""). ! */ ! virtual std::string md5File(std::string& filename); ! /** Download a file or a page to a physical file. ! * Uses wget for now. ! * \param url URL containing data to download ! * \param localfile local filename used to store data ! * \return 1 if ok. ! */ \ ! virtual int download(std::string url, ! std::string localfile); ! /** Copy a local file. ! * Will uses cp on UNIX. ! * \param from source file to be copied ! * \param to destination of the file ! * \return 1 if ok. ! */ ! virtual int copy(std::string from, std::string to) = 0; ! /** Creates a directory ! * \param dir directory name ! * \return 1 if ok. ! */ ! virtual int mkdir(std::string dir) = 0; ! /** Checks if a directory is presents and has correct rights ! * \param dir directory to check ! * \return 1 if ok. ! */ ! virtual int checkDirectory(std::string dir) = 0; ! /** Gives an absolute directory ! * According to the where parameter, returns the temporary directory to use for ! * patches, download, or whatever. Note that CBMSystem::Extract, ! * CBMSystem::Status and CBMSystem::Configuration are host specific in ! * CBMSystem::Root. ! * \param where directory type ! * \return an absolute directory name ! */ ! virtual std::string temporaryDirectory(Temp where); ! /** Removes (unlink) a file ! * \param localfile file to remove ! * \return 1 if Ok. ! */ ! virtual int unlink(std::string localfile) = 0; ! /** Stores an couple key/value ! Each key must be unique. Value can be text, or number. ! \param key Key name ! \param value Value for the key. ! \return 1 if ok. ! */ ! virtual int store(char *key, ! std::string value); ! /** Retrieves the value of a key ! * \param key key name ! * \return key's value ! */ ! virtual std::string read(char *key); ! /** Tests if a file exists ! * \param fn (absolute) filename to test for ! * \return 1 if the file exists ! */ ! virtual int fileExists(std::string fn); ! /** Returns current time in seconds, since EPOC. ! * \return Current time. ! */ ! virtual time_t Time(void); ! /** Release the object. Frees internal pointers, and removes lockfiles. ! \sa init() ! \return 1 if ok. ! */ ! virtual int done(void); ! /** Returns the last command executed by compbenchmarks library. ! \sa lastCommand ! \sa getLastCommandOutput() ! \result a std::string containing the command */ ! virtual std::string& getLastCommand(void); ! /** Returns the last command's output executed by compbenchmarks library. ! \sa lastCommandOutput ! \sa getLastCommand() ! \result a std::string containing the command's output */ ! virtual std::string& getLastCommandOutput(void); ! }; ! extern CBMSystem *cbmSystem; #endif --- 15,302 ---- #include <time.h> ! namespace CBM { ! /** Defines a vector of packages. */ ! typedef std::vector<std::string> PackageVector; ! /** \brief Operating system (and optionnaly hardware) abstraction layer. ! * ! * This class defines the base abstract (pure) object for all supported operating ! * systems. It may also introduces hardware-related dependencies. */ ! class System ! { ! public: ! /** Temporary directory. ! * Defines typedef used to query temporary directories used by CompBenchmarks. ! */ ! typedef enum Temp { Root, /*!< Root directory */ ! HostDep, /*!< Prefix for host-dependend directory */ ! Extract, /*!< Archive extraction temporary directory */ ! Patches, /*!< Directory holding patches */ ! OS, /*!< System specific material */ ! Download, /*!< Downloads temporary directory */ ! Status, /*!< Directory holding status of packages and ! * benchmarks */ ! Configuration /*!< Directory for configuration related ! * informations */ ! }; ! private: ! /** Check if the given directory holds patches. ! * Check if given arguments holds patches needed by libcompbenchmarks. ! * \param dir directory to check ! * \return non-null if ok. ! */ ! virtual int verifyPatchDirectory(std::string dir); ! protected: ! /** \sa Packages() */ ! PackageVector packages; ! /** Stores the last (shell) command executed by compbenchmarks library. */ ! std::string lastCommand; ! /** Stores the output of the last (shell) command executed by ! * compbenchmarks library. */ ! std::string lastCommandOutput; ! /** Constructor. */ ! System(); ! /** Virtual destructor */ ! virtual ~System(); ! /** External command execution. ! * Uses shell to execute command. ! * \param command shell command to execute ! * \return stdout dump ! * \sa exec() ! */ ! virtual std::string exec0(std::string& command); ! virtual std::string exec0(char *command); ! ! /** Returns host's architecture. ! * As uname -m on UNIX. ! * \return Host's architecture ! */ ! virtual std::string arch(void) = 0; ! /** Get host ID ! * As hostid command does on UNIX. ! * \return Host ID as string.*/ ! virtual std::string hostid(void) = 0; ! /** Returns hostname ! * Returns the shortname. ! * \return hostname */ ! virtual std::string hostname(void) = 0; ! /** Returns operating system name ! * \return Operating system name (as uname command on UNIX) */ ! virtual std::string os(void) = 0; ! /** Returns operating system version ! * \return Operating system version (as uname -r command on most UNIXes) */ ! virtual std::string os_version(void) = 0; ! /** Returns processor name ! * Here we infer that each processor on the node are identical, which is the case ! * on x86 and compatible hardware. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void) = 0; ! /** Returns processor speed ! * Processor speed in MHz. Integer expected. ! * \return std::string coding an integer matching the (first) processor speed, in MHz. */ ! virtual std::string processor_mhz(void) = 0; ! /** Returns processor cache ! * Processor second level cache in Kb. Integer expected. ! * \return std::string coding the (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void) = 0; ! /** Returns processors' number ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void) = 0; ! /** Checks a given directory. ! Directory is given according to its purpose in CompBenchmarks. ! \sa Temp ! \sa checkDirectory() ! \return 1 if ok. ! */ ! virtual int CheckDirectory(Temp where); ! public: ! /** Initialize for CompBenchmarks usage. ! * Checks for temporary directories. ! * \return 1 if ok. ! * \sa CheckDirectory() ! */ ! virtual int init(void); ! /** Give a list containing the compatible benchmarks ! * in declared directories. ! * \return a std::string list of benchmarks (id) ! * \sa Package() */ ! virtual PackageVector& packageList(int _force = 0); ! /** Get supported packages' number ! * \return integer ! * \sa Package() */ ! virtual int packageNumber(void); ! /** Get a package according to its index ! * \return Package instance ! * \sa packageNumber() ! */ ! virtual class Package *Package(int index); ! /** Get a package acoording to its internal identifier ! * \param pid std::string containing the package's identifier ! * \return CBMPackage instance ! * \sa packageList() ! */ ! virtual class Package *Package(std::string pid); ! /** Get a benchmark according to its internal identifier ! * \param bid std:string containing the benchmark's identifier ! * \return Benchmark instance */ ! virtual class Benchmark *Benchmark(std::string bid); ! /** Display informations about all packages ! * Used by compbenchmarks-core */ ! virtual void displayAllPackages(void); ! /** Display informations about all benchmarks ! * Used by compbenchmarks-core */ ! virtual void displayAllBenchmarks(void); ! /** Split a std::string. ! * Split given string as sub-strings, according to an arbitrary delimiter. ! * \param str string to split ! * \param delim delimiter ! * \param wantedIndex sub-string index */ ! virtual std::string Split(const std::string& str, ! const std::string& delim, ! unsigned int wantedIndex); ! /** Remove trailing line-feed (and carriage return) from specified string. ! * \param str the string */ ! virtual void Chomp(std::string& str); ! /** Describe host. ! * Displays informations about processors, OS, and so on. ! */ ! virtual void display(void); ! /** Describe external programs. ! * Displays informations about external programs used in CompBenchmarks or in ! * compbenchmark-config program. */ ! virtual void displayPrograms(void); ! /** External command execution. ! * Uses shell to execute command. ! * \param command shell command to execute ! * \param result stdout dump ! * \return return code of the shell command ! */ ! virtual int exec(std::string& command, std::string& result) = 0; ! /** Computes MD5 from a string ! * \param data Data to checksum ! * \return std::string coding data's checksum */ ! virtual std::string md5(std::string& data); ! /** Computes MD5 from a file ! * \param filename absolute filename ! * \return MD5 of the file passed. May be NULL (""). ! */ ! virtual std::string md5File(std::string& filename); ! /** Download a file or a page to a physical file. ! * Uses wget for now. ! * \param url URL containing data to download ! * \param localfile local filename used to store data ! * \return 1 if ok. ! */ \ ! virtual int download(std::string url, ! std::string localfile); ! /** Copy a local file. ! * Will uses cp on UNIX. ! * \param from source file to be copied ! * \param to destination of the file ! * \return 1 if ok. ! */ ! virtual int copy(std::string from, std::string to) = 0; ! /** Creates a directory ! * \param dir directory name ! * \return 1 if ok. ! */ ! virtual int mkdir(std::string dir) = 0; ! /** Checks if a directory is presents and has correct rights ! * \param dir directory to check ! * \return 1 if ok. ! */ ! virtual int checkDirectory(std::string dir) = 0; ! /** Gives an absolute directory ! * According to the where parameter, returns the temporary directory to use for ! * patches, download, or whatever. Note that System::Extract, ! * System::Status and System::Configuration are host specific in ! * System::Root. ! * \param where directory type ! * \return an absolute directory name ! */ ! virtual std::string temporaryDirectory(Temp where); ! /** Removes (unlink) a file ! * \param localfile file to remove ! * \return 1 if Ok. ! */ ! virtual int unlink(std::string localfile) = 0; ! /** Stores an couple key/value ! Each key must be unique. Value can be text, or number. ! \param key Key name ! \param value Value for the key. ! \return 1 if ok. ! */ ! virtual int store(char *key, ! std::string value); ! /** Retrieves the value of a key ! * \param key key name ! * \return key's value ! */ ! virtual std::string read(char *key); ! /** Tests if a file exists ! * \param fn (absolute) filename to test for ! * \return 1 if the file exists ! */ ! virtual int fileExists(std::string fn); ! /** Returns current time in seconds, since EPOC. ! * \return Current time. ! */ ! virtual time_t Time(void); ! /** Release the object. Frees internal pointers, and removes lockfiles. ! \sa init() ! \return 1 if ok. ! */ ! virtual int done(void); ! /** Returns the last command executed by compbenchmarks library. ! \sa lastCommand ! \sa getLastCommandOutput() ! \result a std::string containing the command */ ! virtual std::string& getLastCommand(void); ! /** Returns the last command's output executed by compbenchmarks library. ! \sa lastCommandOutput ! \sa getLastCommand() ! \result a std::string containing the command's output */ ! virtual std::string& getLastCommandOutput(void); ! }; ! extern System *cbmSystem; ! } #endif Index: System-FreeBSD.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-FreeBSD.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** System-FreeBSD.cpp 1 Nov 2006 10:32:17 -0000 1.6 --- System-FreeBSD.cpp 18 Jan 2007 18:43:02 -0000 1.7 *************** *** 12,21 **** #include <config.h> /* !!! */ ! CBMSystemFreeBSD::CBMSystemFreeBSD() ! : CBMSystemUnix() { } ! std::string CBMSystemFreeBSD::processor_name(void) { std::string r = exec0("echo $(/sbin/sysctl hw.model | head -1 | cut -f2 -d'=')"); --- 12,23 ---- #include <config.h> /* !!! */ ! using namespace CBM; ! ! SystemFreeBSD::SystemFreeBSD() ! : SystemUnix() { } ! std::string SystemFreeBSD::processor_name(void) { std::string r = exec0("echo $(/sbin/sysctl hw.model | head -1 | cut -f2 -d'=')"); *************** *** 26,30 **** } ! std::string CBMSystemFreeBSD::processor_mhz(void) { std::string r = exec0("echo $(/sbin/sysctl hw.cpuspeed | head -1 | cut -f2 -d'=')"); --- 28,32 ---- } ! std::string SystemFreeBSD::processor_mhz(void) { std::string r = exec0("echo $(/sbin/sysctl hw.cpuspeed | head -1 | cut -f2 -d'=')"); *************** *** 34,38 **** } ! std::string CBMSystemFreeBSD::processor_cache(void) { std::string r = exec0("echo $(/sbin/sysctl hw.l2cachesize 2> /dev/null | head -1 | cut -f2 -d'=')"); --- 36,40 ---- } ! std::string SystemFreeBSD::processor_cache(void) { std::string r = exec0("echo $(/sbin/sysctl hw.l2cachesize 2> /dev/null | head -1 | cut -f2 -d'=')"); *************** *** 42,46 **** } ! std::string CBMSystemFreeBSD::processor_number(void) { std::string r = exec0("echo $(/sbin/sysctl hw.ncpu | head -1 | cut -f2 -d'=')"); --- 44,48 ---- } ! std::string SystemFreeBSD::processor_number(void) { std::string r = exec0("echo $(/sbin/sysctl hw.ncpu | head -1 | cut -f2 -d'=')"); *************** *** 50,54 **** } ! CBMSystemFreeBSD::~CBMSystemFreeBSD() { } --- 52,56 ---- } ! SystemFreeBSD::~SystemFreeBSD() { } Index: System.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** System.cpp 15 Jan 2007 17:51:28 -0000 1.20 --- System.cpp 18 Jan 2007 18:43:02 -0000 1.21 *************** *** 19,25 **** #define BUF 65535 ! CBMSystem *cbmSystem =0; ! CBMSystem::CBMSystem() { std::string tmp; --- 19,27 ---- #define BUF 65535 ! using namespace CBM; ! System *CBM::cbmSystem =0; ! ! System::System() { std::string tmp; *************** *** 27,42 **** cbmSystem=this; ! if (!UI) ! UI=new CBMUI; tmp=PREFIX; tmp+="/lib"; ! cbmlib_paths.push_back(tmp); ! cbmlib_paths.push_back("./SupportedBenchmarks/.libs"); ! cbmlib_paths.push_back("../../SupportedBenchmarks/.libs"); } ! int CBMSystem::verifyPatchDirectory(std::string dir) { std::string fn; --- 29,44 ---- cbmSystem=this; ! if (!cbmUI) ! cbmUI=new CBM::UI; tmp=PREFIX; tmp+="/lib"; ! CBM::cbmlib_paths.push_back(tmp); ! CBM::cbmlib_paths.push_back("./SupportedBenchmarks/.libs"); ! CBM::cbmlib_paths.push_back("../../SupportedBenchmarks/.libs"); } ! int System::verifyPatchDirectory(std::string dir) { std::string fn; *************** *** 50,60 **** } ! int CBMSystem::CheckDirectory(Temp where) { std::string dir = temporaryDirectory(where); int r; ! UI->Information(CBMUI::DirectoryCheck, ! dir); if (!checkDirectory(dir)) { --- 52,62 ---- } ! int System::CheckDirectory(Temp where) { std::string dir = temporaryDirectory(where); int r; ! cbmUI->Information(CBM::UI::DirectoryCheck, ! dir); if (!checkDirectory(dir)) { *************** *** 64,68 **** std::string msg = "Can't create "; msg+=dir; ! UI->Fatal(msg); } } --- 66,70 ---- std::string msg = "Can't create "; msg+=dir; ! cbmUI->Fatal(msg); } } *************** *** 71,75 **** } ! int CBMSystem::download(std::string url, std::string localfile) { --- 73,77 ---- } ! int System::download(std::string url, std::string localfile) { *************** *** 98,102 **** } ! int CBMSystem::init(void) { std::string pid; --- 100,104 ---- } ! int System::init(void) { std::string pid; *************** *** 104,109 **** pid=read("lockfile.pid"); if (pid!="") { ! UI->Fatal("According to lockfile.pid, process " \ ! " already uses Compbenchmarks' administrative files."); } else { --- 106,111 ---- pid=read("lockfile.pid"); if (pid!="") { ! cbmUI->Fatal("According to lockfile.pid, process " \ ! " already uses Compbenchmarks' administrative files."); } else { *************** *** 129,133 **** ! PackageVector &CBMSystem::packageList(int _force) { DIR *fd; --- 131,135 ---- ! PackageVector &System::packageList(int _force) { DIR *fd; *************** *** 136,140 **** unsigned int e; int p_i; ! int p_n = cbmlib_paths.size(); std::string dir; --- 138,142 ---- unsigned int e; int p_i; ! int p_n = CBM::cbmlib_paths.size(); std::string dir; *************** *** 147,151 **** for(p_i=0;p_i<p_n;p_i++) { ! dir=cbmlib_paths[p_i]; fd=opendir(dir.c_str()); --- 149,153 ---- for(p_i=0;p_i<p_n;p_i++) { ! dir= CBM::cbmlib_paths[p_i]; fd=opendir(dir.c_str()); *************** *** 185,201 **** } ! int CBMSystem::packageNumber(void) { return(packages.size()); } ! CBMPackage *CBMSystem::Package(int index) { return(Package(packages[index])); } ! CBMPackage *CBMSystem::Package(std::string pid) { ! cbmlib_internal *p = cbmlib_load((char*) pid.c_str()); if (p) --- 187,203 ---- } ! int System::packageNumber(void) { return(packages.size()); } ! Package *System::Package(int index) { return(Package(packages[index])); } ! Package *System::Package(std::string pid) { ! CBM::cbmlib_internal *p = CBM::cbmlib_load((char*) pid.c_str()); if (p) *************** *** 205,212 **** } ! CBMBenchmark *CBMSystem::Benchmark(std::string bid) { ! std::string pid; ! CBMPackage *P = 0; pid=Split(bid, "-", 0); --- 207,214 ---- } ! Benchmark *System::Benchmark(std::string bid) { ! std::string pid; ! CBM::Package *P = 0; pid=Split(bid, "-", 0); *************** *** 220,228 **** } ! void CBMSystem::displayAllPackages(void) { ! int i; ! int n = packageNumber(); ! CBMPackage *P; for(i=0; i<n; i++) { --- 222,230 ---- } ! void System::displayAllPackages(void) { ! int i; ! int n = packageNumber(); ! CBM::Package *P; for(i=0; i<n; i++) { *************** *** 232,240 **** } ! void CBMSystem::displayAllBenchmarks(void) { int i; int n = packageNumber(); ! CBMPackage *P; for(i=0; i<n; i++) { --- 234,242 ---- } ! void System::displayAllBenchmarks(void) { int i; int n = packageNumber(); ! CBM::Package *P; for(i=0; i<n; i++) { *************** *** 245,249 **** } ! std::string CBMSystem::Split(const std::string& str, const std::string& delim, unsigned int wantedIndex) { unsigned int offset = 0; --- 247,251 ---- } ! std::string System::Split(const std::string& str, const std::string& delim, unsigned int wantedIndex) { unsigned int offset = 0; *************** *** 267,271 **** } ! void CBMSystem::Chomp(std::string& str) { int l = str.length(); --- 269,273 ---- } ! void System::Chomp(std::string& str) { int l = str.length(); *************** *** 296,300 **** } ! void CBMSystem::display(void) { std::cout << "host::arch=" << arch() << std::endl --- 298,302 ---- } ! void System::display(void) { std::cout << "host::arch=" << arch() << std::endl *************** *** 309,313 **** } ! void CBMSystem::displayPrograms(void) { std::cout << "BZIP2:" << CBM_PROG_BZIP2 << std::endl --- 311,315 ---- } ! void System::displayPrograms(void) { std::cout << "BZIP2:" << CBM_PROG_BZIP2 << std::endl *************** *** 332,336 **** } ! std::string CBMSystem::exec0(std::string& command) { std::string result; --- 334,338 ---- } ! std::string System::exec0(std::string& command) { std::string result; *************** *** 343,347 **** } ! std::string CBMSystem::exec0(char *command) { std::string tmp = command; --- 345,349 ---- } ! std::string System::exec0(char *command) { std::string tmp = command; *************** *** 350,354 **** } ! std::string CBMSystem::md5(std::string& data) { md5_state_t state; --- 352,356 ---- } ! std::string System::md5(std::string& data) { md5_state_t state; *************** *** 371,375 **** } ! std::string CBMSystem::md5File(std::string& filename) { std::ifstream IN(filename.c_str(), --- 373,377 ---- } ! std::string System::md5File(std::string& filename) { std::ifstream IN(filename.c_str(), *************** *** 399,403 **** str="Invalid MD5 for "; str+=filename; ! UI->Fatal(str); result=""; } --- 401,405 ---- str="Invalid MD5 for "; str+=filename; ! cbmUI->Fatal(str); result=""; } *************** *** 406,410 **** } ! std::string CBMSystem::temporaryDirectory(Temp where) { std::string result; --- 408,412 ---- } ! std::string System::temporaryDirectory(Temp where) { std::string result; *************** *** 458,462 **** } break; ! case System: result=DATAROOTDIR; result+="/"; --- 460,464 ---- } break; ! case OS: result=DATAROOTDIR; result+="/"; *************** *** 477,481 **** break; default: ! UI->Fatal("Internal : Bad 'where' parameters in CBMSystem::temporaryDirectory();"); return(""); } --- 479,483 ---- break; default: ! cbmUI->Fatal("Internal : Bad 'where' parameters in System::temporaryDirectory();"); return(""); } *************** *** 484,488 **** } ! int CBMSystem::store(char *key, std::string value) { --- 486,490 ---- } ! int System::store(char *key, std::string value) { *************** *** 490,494 **** std::ofstream OUT; ! fn=temporaryDirectory(CBMSystem::Status); fn+="/"; fn+=key; --- 492,496 ---- std::ofstream OUT; ! fn=temporaryDirectory(System::Status); fn+="/"; fn+=key; *************** *** 501,505 **** } ! std::string CBMSystem::read(char *key) { std::string fn; --- 503,507 ---- } ! std::string System::read(char *key) { std::string fn; *************** *** 509,513 **** std::string result; ! fn=temporaryDirectory(CBMSystem::Status); fn+="/"; fn+=key; --- 511,515 ---- std::string result; ! fn=temporaryDirectory(System::Status); fn+="/"; fn+=key; *************** *** 535,539 **** } ! int CBMSystem::fileExists(std::string fn) { std::ifstream IN; --- 537,541 ---- } ! int System::fileExists(std::string fn) { std::ifstream IN; *************** *** 550,565 **** } ! time_t CBMSystem::Time(void) { return(time(NULL)); } ! int CBMSystem::done(void) { std::string fn; ! cbmlib_done(); ! ! fn=temporaryDirectory(CBMSystem::Status); fn+="/"; fn+="lockfile.pid"; --- 552,566 ---- } ! time_t System::Time(void) { return(time(NULL)); } ! int System::done(void) { std::string fn; + CBM::cbmlib_done(); ! fn=temporaryDirectory(System::Status); fn+="/"; fn+="lockfile.pid"; *************** *** 567,581 **** } ! std::string& CBMSystem::getLastCommand(void) { return(lastCommand); } ! std::string& CBMSystem::getLastCommandOutput(void) { return(lastCommandOutput); } ! CBMSystem::~CBMSystem() { } --- 568,582 ---- } ! std::string& System::getLastCommand(void) { return(lastCommand); } ! std::string& System::getLastCommandOutput(void) { return(lastCommandOutput); } ! System::~System() { } Index: XML.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/XML.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XML.h 17 Jan 2007 20:12:30 -0000 1.2 --- XML.h 18 Jan 2007 18:43:02 -0000 1.3 *************** *** 13,143 **** #include <vector> ! /** \brief XML Attribute ! * Internal representation for an XML attribute. ! */ ! class CBMXMLAttribute ! { ! protected: ! std::string name; /*!< Attribute name */ ! std::string value; /*!< Attribute value */ ! public: ! /** Constructor ! * Initialise a new attribute. ! * \param _name Attribute's name ! * \param _value Attribute's value (optional) */ ! CBMXMLAttribute(std::string _name, ! std::string _value = ""); ! /** Get attribute's name ! \return a std::string */ ! virtual std::string Name(void); ! /** Get attribute's value ! \return a std::string */ ! virtual std::string Value(void); ! /** Set attribute's value ! \param _value new value (std::string) ! */ ! virtual void setValue(std::string _value); ! /** Destructor */ ! virtual ~CBMXMLAttribute(); ! }; ! /** \brief XML Node ! * Internal representation of an XML node. ! */ ! class CBMXMLNode ! { ! protected: ! std::vector<CBMXMLNode*> childs; /*!< Child nodes */ ! std::vector<CBMXMLAttribute*> attributes; /*!< Node's attributes */ ! std::string name; /*!< Node's name */ ! std::string value; /*!< Node value */ ! virtual void indent(std::string& str, ! int _indent); ! public: ! /** Constructor ! * Initialise a new node. ! * \param _name Node's name ! * \param _value Node's value (optional) */ ! CBMXMLNode(std::string _name, ! std::string _value = ""); ! /** Get node's name ! \return a std::string */ ! virtual std::string Name(void); ! /** Get node's value ! \return a std::string */ ! virtual std::string Value(void); ! /** Set node's value ! \param _value new value (std::string) ! */ ! virtual void setValue(std::string _value); ! /** Get childs' number ! * \return number of nodes held by current node ! * \sa getChild() */ ! virtual int childNumber(void); ! /** Get a child node according to its index ! * \return A node ! * \sa childNumber() */ ! virtual CBMXMLNode *getChild(int _index); ! /** Get attributes' number ! * \return number of attributes on current node ! * \sa getAttribute() */ ! virtual int attributeNumber(void); - /** Get an attribute according to its index - * \return An attribute - * \sa attributeNumber() */ - virtual CBMXMLAttribute *getAttribute(int _index); ! /** Add a node into current node ! * \param _child node to add ! * \return node added (_child) ! * \sa addNode() */ ! virtual CBMXMLNode *add(CBMXMLNode *_child); ! /** Add a node into current node ! * \param _name name of the node ! * \param _value value of the node (optional) ! * \return node added (_child) ! * \sa add() */ ! virtual CBMXMLNode *addNode(std::string _name, ! std::string _value = ""); ! /** Add an attribute on current node ! * \param _attribute to add ! * \return attribute added (_attribute) ! * \sa addAttribute() */ ! virtual CBMXMLAttribute *add(CBMXMLAttribute *_attribute); ! /** Add an attribute on current node ! * \param _name name of the attribute ! * \param _value value of the attribute (optional) ! * \return attribute added (_attribute) ! * \sa add() */ ! virtual CBMXMLAttribute *addAttribute(std::string _name, ! std::string _value = ""); - /** Get textual (XML) representation of the node - * Build a string corresponding to the XML elements of current node and - * childs (includes attributes and value). - * \param _indent Optional indentation level; internal use only. - * \return string (XML formatted) */ - virtual std::string str(int _indent = 0); ! virtual ~CBMXMLNode(); ! }; #endif --- 13,149 ---- #include <vector> ! namespace CBM { ! namespace XML { ! /** \brief XML Attribute ! * Internal representation for an XML attribute. ! */ ! class Attribute ! { ! protected: ! std::string name; /*!< Attribute name */ ! std::string value; /*!< Attribute value */ ! public: ! /** Constructor ! * Initialise a new attribute. ! * \param _name Attribute's name ! * \param _value Attribute's value (optional) */ ! Attribute(std::string _name, ! std::string _value = ""); ! /** Get attribute's name ! \return a std::string */ ! virtual std::string Name(void); ! /** Get attribute's value ! \return a std::string */ ! virtual std::string Value(void); ! /** Set attribute's value ! \param _value new value (std::string) ! */ ! virtual void setValue(std::string _value); ! /** Destructor */ ! virtual ~Attribute(); ! }; ! /** \brief XML Node ! * Internal representation of an XML node. ! */ ! class Node ! { ! protected: ! std::vector<Node*> childs; /*!< Child nodes */ ! std::vector<Attribute*> attributes; /*!< Node's attributes */ ! std::string name; /*!< Node's name */ ! std::string value; /*!< Node value */ ! virtual void indent(std::string& str, ! int _indent); ! public: ! /** Constructor ! * Initialise a new node. ! * \param _name Node's name ! * \param _value Node's value (optional) */ ! Node(std::string _name, ! std::string _value = ""); ! /** Get node's name ! \return a std::string */ ! virtual std::string Name(void); ! /** Get node's value ! \return a std::string */ ! virtual std::string Value(void); ! /** Set node's value ! \param _value new value (std::string) ! */ ! virtual void setValue(std::string _value); + /** Get childs' number + * \return number of nodes held by current node + * \sa getChild() */ + virtual int childNumber(void); ! /** Get a child node according to its index ! * \return A node ! * \sa childNumber() */ ! virtual Node *getChild(int _index); ! /** Get attributes' number ! * \return number of attributes on current node ! * \sa getAttribute() */ ! virtual int attributeNumber(void); ! /** Get an attribute according to its index ! * \return An attribute ! * \sa attributeNumber() */ ! virtual Attribute *getAttribute(int _index); ! /** Add a node into current node ! * \param _child node to add ! * \return node added (_child) ! * \sa addNode() */ ! virtual Node *add(Node *_child); + /** Add a node into current node + * \param _name name of the node + * \param _value value of the node (optional) + * \return node added (_child) + * \sa add() */ + virtual Node *addNode(std::string _name, + std::string _value = ""); ! /** Add an attribute on current node ! * \param _attribute to add ! * \return attribute added (_attribute) ! * \sa addAttribute() */ ! virtual Attribute *add(Attribute *_attribute); ! /** Add an attribute on current node ! * \param _name name of the attribute ! * \param _value value of the attribute (optional) ! * \return attribute added (_attribute) ! * \sa add() */ ! virtual Attribute *addAttribute(std::string _name, ! std::string _value = ""); ! ! /** Get textual (XML) representation of the node ! * Build a string corresponding to the XML elements of current node and ! * childs (includes attributes and value). ! * \param _indent Optional indentation level; internal use only. ! * \return string (XML formatted) */ ! virtual std::string str(int _indent = 0); ! ! virtual ~Node(); ! }; ! } ! } #endif Index: System-Linux.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Linux.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** System-Linux.h 19 Sep 2006 17:08:24 -0000 1.3 --- System-Linux.h 18 Jan 2007 18:43:02 -0000 1.4 *************** *** 12,52 **** #include <System/System-Unix.h> ! /** \brief Linux operating system support class. ! * ! * Implements a few methods not defined by CBMSystemUnix to handle properly ! * Linux systems in CompBenchmarks. ! */ ! class CBMSystemLinux : public CBMSystemUnix ! { ! protected: ! public: ! /** Constructor */ ! CBMSystemLinux(); ! /** Returns processor name ! * Uses /proc to get the name of the first installed processor. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void); ! /** Returns processor speed ! * Uses /proc to get the speed, in MHz, of the first installed processor. ! * \return Processor speed in MHz, as clear text (integer returned) ! * \sa processor_number() */ ! virtual std::string processor_mhz(void); ! /** Returns processor cache ! * Uses /proc to get processor second level cache in Kb. Integer expected. ! * \return std::string coding (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void); ! /** Returns processors' number ! * Uses /proc to get information. ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void); ! /** Virtual destructor */ ! virtual ~CBMSystemLinux(); ! }; #endif --- 12,54 ---- #include <System/System-Unix.h> ! namespace CBM { ! /** \brief Linux operating system support class. ! * ! * Implements a few methods not defined by SystemUnix to handle properly ! * Linux systems in CompBenchmarks. ! */ ! class SystemLinux : public SystemUnix ! { ! protected: ! public: ! /** Constructor */ ! SystemLinux(); ! /** Returns processor name ! * Uses /proc to get the name of the first installed processor. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void); ! /** Returns processor speed ! * Uses /proc to get the speed, in MHz, of the first installed processor. ! * \return Processor speed in MHz, as clear text (integer returned) ! * \sa processor_number() */ ! virtual std::string processor_mhz(void); ! /** Returns processor cache ! * Uses /proc to get processor second level cache in Kb. Integer expected. ! * \return std::string coding (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void); ! /** Returns processors' number ! * Uses /proc to get information. ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void); ! /** Virtual destructor */ ! virtual ~SystemLinux(); ! }; ! } #endif Index: System-FreeBSD.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-FreeBSD.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** System-FreeBSD.h 25 Sep 2006 17:42:35 -0000 1.2 --- System-FreeBSD.h 18 Jan 2007 18:43:02 -0000 1.3 *************** *** 12,52 **** #include <System/System-Unix.h> ! /** \brief FreeBSD operating system support class. ! * ! * Implements a few methods not defined by CBMSystemUnix to handle properly ! * FreeBSD systems in CompBenchmarks. ! */ ! class CBMSystemFreeBSD : public CBMSystemUnix ! { ! protected: ! public: ! /** Constructor */ ! CBMSystemFreeBSD(); ! /** Returns processor name ! * Uses /sbin/sysctl to get the name of the first installed processor. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void); ! /** Returns processor speed ! * Uses /sbin/sysctl to get the speed, in MHz, of the first installed processor. ! * \return Processor speed in MHz, as clear text (integer returned) ! * \sa processor_number() */ ! virtual std::string processor_mhz(void); ! /** Returns processor cache ! * Uses /sbin/sysctl to get processor second level cache in Kb. Integer expected. ! * \return std::string coding (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void); ! /** Returns processors' number ! * Uses /sbin/sysctl to get information. ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void); ! /** Virtual destructor */ ! virtual ~CBMSystemFreeBSD(); ! }; #endif --- 12,54 ---- #include <System/System-Unix.h> ! namespace CBM { ! /** \brief FreeBSD operating system support class. ! * ! * Implements a few methods not defined by SystemUnix to handle properly ! * FreeBSD systems in CompBenchmarks. ! */ ! class SystemFreeBSD : public SystemUnix ! { ! protected: ! public: ! /** Constructor */ ! SystemFreeBSD(); ! /** Returns processor name ! * Uses /sbin/sysctl to get the name of the first installed processor. ! * \return Processor name, as clear text ! * \sa processor_number() */ ! virtual std::string processor_name(void); ! /** Returns processor speed ! * Uses /sbin/sysctl to get the speed, in MHz, of the first installed processor. ! * \return Processor speed in MHz, as clear text (integer returned) ! * \sa processor_number() */ ! virtual std::string processor_mhz(void); ! /** Returns processor cache ! * Uses /sbin/sysctl to get processor second level cache in Kb. Integer expected. ! * \return std::string coding (first) processor second level cache in Kb. */ ! virtual std::string processor_cache(void); ! /** Returns processors' number ! * Uses /sbin/sysctl to get information. ! * \return std::string coding the number of processors (physical and logical) on host */ ! virtual std::string processor_number(void); ! /** Virtual destructor */ ! virtual ~SystemFreeBSD(); ! }; ! } #endif Index: System-Unix.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Unix.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** System-Unix.cpp 28 Dec 2006 13:15:07 -0000 1.7 --- System-Unix.cpp 18 Jan 2007 18:43:02 -0000 1.8 *************** *** 12,15 **** --- 12,17 ---- #include <stdio.h> + using namespace CBM; + void sysunix_sighandler(int signal) { *************** *** 20,30 **** } ! CBMSystemUnix::CBMSystemUnix() ! : CBMSystem() { signal(SIGINT, sysunix_sighandler); } ! int CBMSystemUnix::copy(std::string from, std::string to) { std::string cmd; --- 22,32 ---- } ! SystemUnix::SystemUnix() ! : System() { signal(SIGINT, sysunix_sighandler); } ! int SystemUnix::copy(std::string from, std::string to) { std::string cm... [truncated message content] |