author | schurig <schurig> | 2004-09-10 06:11:06 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-10 06:11:06 (UTC) |
commit | 0209835eb255beb66cf021c02e659ed8ab02dcd1 (patch) (side-by-side diff) | |
tree | 5ff8a0fc6a17aef41fb29ebf1c57359cbd42f461 | |
parent | 931d699302619ac6472aca4b893d8a8bd188f040 (diff) | |
download | opie-0209835eb255beb66cf021c02e659ed8ab02dcd1.zip opie-0209835eb255beb66cf021c02e659ed8ab02dcd1.tar.gz opie-0209835eb255beb66cf021c02e659ed8ab02dcd1.tar.bz2 |
oops, one 'b' to much
-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 47be13c..be7e4b6 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp @@ -215,197 +215,197 @@ void BenchmarkInfo::run() } if ( test_txt->isOn() ) { int value = textRendering( TEST_DURATION ); test_txt->setText( 1, QString().sprintf( "%d chars/sec", value / TEST_DURATION ) ); test_txt->setOn( false ); } if ( test_gfx->isOn() ) { int value = gfxRendering( TEST_DURATION ); test_gfx->setText( 1, QString().sprintf( "%.2f gops/sec", value / 4.0 / TEST_DURATION ) ); // 4 tests test_gfx->setOn( false ); } if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA { performFileTest( "/tmp/benchmarkFile.dat", test_ram ); } #ifndef QT_QWS_RAMSES if ( test_cf->isOn() ) { OStorageInfo storage; performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf ); } if ( test_sd->isOn() ) { OStorageInfo storage; performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd ); } #endif startButton->setText( tr( "&Start Tests!" ) ); } int BenchmarkInfo::textRendering( int seconds ) { QTime t; t.start(); int stop = t.elapsed() + seconds * 1000; int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; const QString text( "Opie Benchmark Test" ); int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height(); srand( time( NULL ) ); BenchmarkPaintWidget bpw; int loops = 0; while ( t.elapsed() < stop ) { int k = rand() % 9; int s = rand() % 100; bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); bpw.p.setFont( QFont( "Vera", s ) ); bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); ++loops; } return loops * text.length(); } int BenchmarkInfo::gfxRendering( int seconds ) { int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height(); srand( time( NULL ) ); BenchmarkPaintWidget bpw; QTime t; t.start(); int stop = t.elapsed() + seconds*1000; int loops = 0; while ( t.elapsed() < stop ) { int k = rand() % 9; bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); ++loops; } t.restart(); stop = t.elapsed() + seconds*1000; while ( t.elapsed() < stop ) { int k = rand() % 9; bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); ++loops; } QBrush br1; br1.setStyle( SolidPattern ); t.restart(); stop = t.elapsed() + seconds*1000; while ( t.elapsed() < stop ) { int k = rand() % 9; br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); ++loops; } QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); t.restart(); stop = t.elapsed() + seconds*1000; while ( t.elapsed() < stop ) { bpw.p.drawPixmap( rand()%w, rand()%h, p ); ++loops; } return loops; } const unsigned int FILE_TEST_COUNT = 8000; const unsigned int FILE_TEST_BLOCKSIZE = 1024; void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item ) { QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname; odebug << "performing file test on " << filename << oendl; QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename ) .arg( FILE_TEST_COUNT ) .arg( FILE_TEST_BLOCKSIZE ); QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename ) .arg( FILE_TEST_COUNT ) .arg( FILE_TEST_BLOCKSIZE ); ::system( "sync" ); odebug << "performing file test on " << filename << oendl; int write = 0; int read = 0; QTime time; time.start(); if ( ::system( writeCommand ) == 0 ) { write = time.elapsed(); } else { item->setText( 1, tr( "error" ) ); return; } time.restart(); if ( ::system( readCommand ) == 0 ) { read = time.elapsed(); } else { item->setText( 1, tr( "error" ) ); return; } QFile::remove( filename ); double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 ); QString readUnit = "kB/s"; if ( readSpeed > 1024 ) { readSpeed = readSpeed / 1024.0; readUnit = "MB/s"; } double writeSpeed = FILE_TEST_COUNT / ( write / 1000.0 ); QString writeUnit = "kb/s"; if ( writeSpeed > 1024 ) { writeSpeed = writeSpeed / 1024.0; - writeUnit = "MBb/s"; + writeUnit = "MB/s"; } item->setText( 1, QString().sprintf( "%.2f %s, %.2f %s", readSpeed, readUnit.latin1(), writeSpeed, writeUnit.latin1() ) ); item->setOn( false ); } |