Diffstat (limited to 'noncore/settings/sysinfo/benchmarkinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 62146f7..1d0b140 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp @@ -1,175 +1,176 @@ /********************************************************************** ** BenchmarkInfo ** ** A benchmark for Qt/Embedded ** ** Copyright (C) 2004 Michael Lauer <mickey@vanille.de> ** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp> ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ /* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpedecoration_qws.h> #include <qpe/resource.h> #include <qpe/config.h> /* QT */ #include <qlayout.h> #include <qfiledialog.h> #include <qlabel.h> #include <qpainter.h> #include <qdirectpainter_qws.h> #include <qapplication.h> #include <qpushbutton.h> #include <qclipboard.h> #include <qtimer.h> #include <qcolor.h> #include <qpushbutton.h> /* STD */ -#include <stdio.h> #include <time.h> +#include <stdio.h> #include <stdlib.h> +#include <math.h> #include "benchmarkinfo.h" extern "C" { void BenchFFT( void ); + double dhry_main( int ); } //=========================================================================== class BenchmarkPaintWidget : public QWidget { public: BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) { resize( QApplication::desktop()->size() ); show(); p.begin( this ); }; ~BenchmarkPaintWidget() { p.end(); hide(); }; QPainter p; }; //=========================================================================== BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) : QWidget( parent, name, wFlags ) { setMinimumSize( 200, 150 ); QVBoxLayout* vb = new QVBoxLayout( this ); vb->setSpacing( 4 ); vb->setMargin( 4 ); tests = new QListView( this ); tests->setMargin( 1 ); tests->addColumn( "Tests" ); tests->addColumn( "Results" ); tests->setShowSortIndicator( true ); test_alu = new QCheckListItem( tests, "1: Integer Arithmetic ", QCheckListItem::CheckBox ); test_alu->setText( 1, "n/a" ); test_fpu = new QCheckListItem( tests, "2: Floating Point Unit ", QCheckListItem::CheckBox ); test_fpu->setText( 1, "n/a" ); test_txt = new QCheckListItem( tests, "3: Text Rendering ", QCheckListItem::CheckBox ); test_txt->setText( 1, "n/a" ); test_gfx = new QCheckListItem( tests, "4: Gfx Rendering ", QCheckListItem::CheckBox ); test_gfx->setText( 1, "n/a" ); test_ram = new QCheckListItem( tests, "5: RAM Performance ", QCheckListItem::CheckBox ); test_ram->setText( 1, "n/a" ); test_sd = new QCheckListItem( tests, "6: SD Card Performance ", QCheckListItem::CheckBox ); test_sd->setText( 1, "n/a" ); test_cf = new QCheckListItem( tests, "7: CF Card Performance ", QCheckListItem::CheckBox ); test_cf->setText( 1, "n/a" ); startButton = new QPushButton( tr( "&Start Tests!" ), this ); connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); vb->addWidget( tests, 2 ); vb->addWidget( startButton ); } BenchmarkInfo::~BenchmarkInfo() {} void BenchmarkInfo::run() { startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); qApp->processEvents(); QTime t; if ( test_alu->isOn() ) { - t.start(); - benchInteger(); - test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + int d = round( dhry_main( DHRYSTONE_RUNS ) ); + test_alu->setText( 1, QString( "%1 DHRYS" ).arg( QString::number( d ) ) ); test_alu->setOn( false ); } if ( test_fpu->isOn() ) { t.start(); BenchFFT(); test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); test_fpu->setOn( false ); } if ( test_txt->isOn() ) { t.start(); paintChar(); test_txt->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); test_txt->setOn( false ); } if ( test_gfx->isOn() ) { t.start(); paintLineRect(); test_gfx->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); test_gfx->setOn( false ); } if ( test_ram->isOn() ) { t.start(); writeFile( "/tmp/benchmarkFile.dat" ); // /tmp is supposed to be in RAM on a PDA readFile( "/tmp/benchmarkFile.dat" ); QFile::remove( "/tmp/benchmarkFile.dat" ); test_ram->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); test_ram->setOn( false ); } /* if ( test_cf->isOn() ) { t.start(); benchInteger(); test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); test_alu->setOn( false ); } if ( test_sd->isOn() ) { t.start(); |