[Compbench-devel] CompBenchmarks++/System System-Cygwin.cpp, NONE, 1.1 System-Cygwin.h, NONE, 1.1 M
Brought to you by:
xfred
|
From: Frederic T. <xf...@us...> - 2006-09-25 15:26:44
|
Update of /cvsroot/compbench/CompBenchmarks++/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3376 Modified Files: Makefile.am Makefile.in Added Files: System-Cygwin.cpp System-Cygwin.h Log Message: Cygwin support. Index: Makefile.in =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 20 Sep 2006 10:48:43 -0000 1.4 --- Makefile.in 25 Sep 2006 15:26:39 -0000 1.5 *************** *** 106,111 **** noinst_LTLIBRARIES = libSystem.la - @CBM_SYSTEM_LINUX_TRUE@source_sys = System-Linux.cpp sources = System.cpp System-Unix.cpp md5.cpp --- 106,111 ---- noinst_LTLIBRARIES = libSystem.la @CBM_SYSTEM_LINUX_TRUE@source_sys = System-Linux.cpp + @CBM_SYSTEM_LINUX_FALSE@@CBM_SYSTEM_CYGWIN_TRUE@source_sys = System-Cygwin.cpp sources = System.cpp System-Unix.cpp md5.cpp *************** *** 132,139 **** libSystem_la_LDFLAGS = libSystem_la_LIBADD = ! @CBM_SYSTEM_LINUX_FALSE@libSystem_la_OBJECTS = System.lo System-Unix.lo \ ! @CBM...@md... ! @CBM_SYSTEM_LINUX_TRUE@libSystem_la_OBJECTS = System.lo System-Unix.lo \ ! @CBM...@md... System-Linux.lo CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) --- 132,149 ---- libSystem_la_LDFLAGS = libSystem_la_LIBADD = ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM_SYSTEM_LINUX_FALSE@libSystem_la_OBJECTS = \ ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM...@Sy... \ ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM...@Sy... md5.lo ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM_SYSTEM_LINUX_TRUE@libSystem_la_OBJECTS = \ ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM...@Sy... \ ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM...@Sy... md5.lo \ ! @CBM_SYSTEM_CYGWIN_FALSE@@CBM...@Sy... ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM_SYSTEM_LINUX_TRUE@libSystem_la_OBJECTS = \ ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM...@Sy... System-Unix.lo \ ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM...@md... System-Linux.lo ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM_SYSTEM_LINUX_FALSE@libSystem_la_OBJECTS = \ ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM...@Sy... \ ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM...@Sy... md5.lo \ ! @CBM_SYSTEM_CYGWIN_TRUE@@CBM...@Sy... CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) *************** *** 149,154 **** TAR = tar GZIP_ENV = --best - DEP_FILES = .deps/System-Linux.P .deps/System-Unix.P .deps/System.P \ - .deps/md5.P SOURCES = $(libSystem_la_SOURCES) OBJECTS = $(libSystem_la_OBJECTS) --- 159,162 ---- *************** *** 158,164 **** .SUFFIXES: .S .c .cpp .lo .o .obj .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ! cd $(top_srcdir) && $(AUTOMAKE) --gnu System/Makefile ! Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status --- 166,172 ---- .SUFFIXES: .S .c .cpp .lo .o .obj .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ! cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps System/Makefile ! Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status *************** *** 174,177 **** --- 182,188 ---- maintainer-clean-noinstLTLIBRARIES: + .c.o: + $(COMPILE) -c $< + # FIXME: We should only use cygpath when building on Windows, # and only if it is available. *************** *** 196,199 **** --- 207,213 ---- maintainer-clean-compile: + .c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< *************** *** 255,263 **** distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu System/Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ --- 269,272 ---- *************** *** 270,324 **** fi; \ done - - DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - - -include $(DEP_FILES) - - mostlyclean-depend: - - clean-depend: - - distclean-depend: - -rm -rf .deps - - maintainer-clean-depend: - - %.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - - %.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp - - %.o: %.cpp - @echo '$(CXXCOMPILE) -c $<'; \ - $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - - %.lo: %.cpp - @echo '$(LTCXXCOMPILE) -c $<'; \ - $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp info-am: info: info-am --- 279,282 ---- *************** *** 357,361 **** maintainer-clean-generic: mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \ ! mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ mostlyclean-generic --- 315,319 ---- maintainer-clean-generic: mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \ ! mostlyclean-libtool mostlyclean-tags \ mostlyclean-generic *************** *** 363,373 **** clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \ ! clean-tags clean-depend clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-noinstLTLIBRARIES distclean-compile \ ! distclean-libtool distclean-tags distclean-depend \ ! distclean-generic clean-am -rm -f libtool --- 321,331 ---- clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \ ! clean-tags clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-noinstLTLIBRARIES distclean-compile \ ! distclean-libtool distclean-tags distclean-generic \ ! clean-am -rm -f libtool *************** *** 376,381 **** maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ ! maintainer-clean-tags maintainer-clean-depend \ ! maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." --- 334,339 ---- maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ ! maintainer-clean-tags maintainer-clean-generic \ ! distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." *************** *** 388,399 **** maintainer-clean-compile mostlyclean-libtool distclean-libtool \ clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ ! distclean-tags clean-tags maintainer-clean-tags distdir \ ! mostlyclean-depend distclean-depend clean-depend \ ! maintainer-clean-depend info-am info dvi-am dvi check check-am \ ! installcheck-am installcheck install-exec-am install-exec \ ! install-data-am install-data install-am install uninstall-am uninstall \ ! all-redirect all-am all installdirs mostlyclean-generic \ ! distclean-generic clean-generic maintainer-clean-generic clean \ ! mostlyclean distclean maintainer-clean # -I /usr/include/w3c-libwww # !!! --- 346,355 ---- maintainer-clean-compile mostlyclean-libtool distclean-libtool \ clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ ! distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ ! dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ ! install-exec install-data-am install-data install-am install \ ! uninstall-am uninstall all-redirect all-am all installdirs \ ! mostlyclean-generic distclean-generic clean-generic \ ! maintainer-clean-generic clean mostlyclean distclean maintainer-clean # -I /usr/include/w3c-libwww # !!! --- NEW FILE: System-Cygwin.cpp --- #include <System/System-Cygwin.h> #include <string> #include <config.h> /* !!! */ CBMSystemCygwin::CBMSystemCygwin() : CBMSystemUnix() { std::string cmd = "cscript.exe /nologo systemInfo.wmi"; exec(cmd, cache); } std::string CBMSystemCygwin::Split(const std::string& str, const std::string& delim, int wantedIndex) { unsigned int offset = 0; unsigned int delimIndex = 0; unsigned int nowIndex = 0; delimIndex = str.find(delim, offset); while (delimIndex != std::string::npos) { if (wantedIndex==nowIndex) return(str.substr(offset, delimIndex - offset)); offset += delimIndex - offset + delim.length(); delimIndex = str.find(delim, offset); nowIndex++; } if (wantedIndex==nowIndex) return(str.substr(offset)); else return(""); } std::string CBMSystemCygwin::processor_name(void) { return(Split(cache, "\n", 2)); } std::string CBMSystemCygwin::processor_mhz(void) { return(Split(cache, "\n", 0)); } std::string CBMSystemCygwin::processor_cache(void) { return(Split(cache, "\n", 1)); } std::string CBMSystemCygwin::processor_number(void) { return(Split(cache, "\n", 3)); } CBMSystemCygwin::~CBMSystemCygwin() { } Index: Makefile.am =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.am 11 Sep 2006 18:29:26 -0000 1.3 --- Makefile.am 25 Sep 2006 15:26:39 -0000 1.4 *************** *** 3,6 **** --- 3,10 ---- if CBM_SYSTEM_LINUX source_sys = System-Linux.cpp + else + if CBM_SYSTEM_CYGWIN + source_sys = System-Cygwin.cpp + endif endif --- NEW FILE: System-Cygwin.h --- /* ---------------------------------------------------------------------------- $Id: System-Cygwin.h,v 1.1 2006/09/25 15:26:39 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #ifndef H_CBMSYSTEMCYGWIN #define H_CBMSYSTEMCYGWIN #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; virtual std::string Split(const std::string& str, const std::string& delim, int wantedIndex); 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 |