[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Benchmark Benchmark-xZIP.cpp, 1.3, 1.4 Benchma
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-16 12:07:13
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17854 Modified Files: Benchmark-xZIP.cpp Benchmark-xZIP.h Log Message: Improved UI API. Threaded preConfigure(); Index: Benchmark-xZIP.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Benchmark-xZIP.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Benchmark-xZIP.cpp 7 May 2007 20:06:15 -0000 1.3 --- Benchmark-xZIP.cpp 16 May 2007 12:07:09 -0000 1.4 *************** *** 9,12 **** --- 9,13 ---- #include <Benchmark/Benchmark-xZIP.h> #include <System/System.h> + #include <UI/UI.h> #include <fstream> *************** *** 14,41 **** using namespace CBM; ! PackagexZIP::PackagexZIP(CBM::System *_system) ! : PackageAutotools(_system) { } ! int PackagexZIP::preConfigure(int _force) { - std::string fileName; - std::ofstream OUT; int n = 12 * 1024 * 1024; ! fileName+=localAbsoluteDirectory(); ! fileName+="/Compbenchmarks.dat"; ! ! OUT.open(fileName.c_str(), std::ios::out); ! /* !!! */ while (n--) { OUT << std::hex << n; } OUT.close(); return(1); } PackagexZIP::~PackagexZIP() { --- 15,75 ---- using namespace CBM; ! PackagexZIPPreconfigureThread::PackagexZIPPreconfigureThread(std::string _filename) ! : ThreadAction() { + filename=_filename; } ! void PackagexZIPPreconfigureThread::routine(void) { int n = 12 * 1024 * 1024; + std::ofstream OUT; ! OUT.open(filename.c_str(), std::ios::out); while (n--) { OUT << std::hex << n; } OUT.close(); + } + + float PackagexZIPPreconfigureThread::Progress(void) + { + float expect = 74378992; + int now = cbmSystem->fileSize(filename); + + return( (((float)now)*100)/expect ); + } + + PackagexZIPPreconfigureThread::~PackagexZIPPreconfigureThread() + { + } + + + PackagexZIP::PackagexZIP(CBM::System *_system) + : PackageAutotools(_system) + { + } + int PackagexZIP::preConfigure(int _force) + { + std::string fileName; + + fileName+=localAbsoluteDirectory(); + fileName+="/Compbenchmarks.dat"; + + PackagexZIPPreconfigureThread T(fileName); + T.Start(); + + while(!T.Terminated()) { + sleep(1); + cbmUI->Information(CBM::UI::PackagePreconfigure, + CBM::UI::Running, + T.Progress()); + } + return(1); } + PackagexZIP::~PackagexZIP() { Index: Benchmark-xZIP.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Benchmark/Benchmark-xZIP.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Benchmark-xZIP.h 22 Jan 2007 18:21:47 -0000 1.1 --- Benchmark-xZIP.h 16 May 2007 12:07:09 -0000 1.2 *************** *** 11,16 **** --- 11,32 ---- #include <Benchmark/Benchmark-Autotools.h> + #include <Base/Thread.h> namespace CBM { + class PackagexZIPPreconfigureThread : public ThreadAction { + private: + std::string filename; + + protected: + virtual void routine(void); + + public: + PackagexZIPPreconfigureThread(std::string _filename); + + virtual float Progress(void); + + virtual ~PackagexZIPPreconfigureThread(); + }; + /** \brief Defines an abstract package based on ZIP utilities. * |