summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index fde032a..793fcb1 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -310,99 +310,99 @@ int BenchmarkInfo::gfxRendering( int seconds )
310 t.restart(); 310 t.restart();
311 stop = t.elapsed() + seconds*1000; 311 stop = t.elapsed() + seconds*1000;
312 312
313 while ( t.elapsed() < stop ) 313 while ( t.elapsed() < stop )
314 { 314 {
315 int k = rand() % 9; 315 int k = rand() % 9;
316 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 316 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
317 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); 317 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 );
318 ++loops; 318 ++loops;
319 } 319 }
320 320
321 QBrush br1; 321 QBrush br1;
322 br1.setStyle( SolidPattern ); 322 br1.setStyle( SolidPattern );
323 t.restart(); 323 t.restart();
324 stop = t.elapsed() + seconds*1000; 324 stop = t.elapsed() + seconds*1000;
325 325
326 while ( t.elapsed() < stop ) 326 while ( t.elapsed() < stop )
327 { 327 {
328 int k = rand() % 9; 328 int k = rand() % 9;
329 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 329 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
330 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); 330 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 );
331 ++loops; 331 ++loops;
332 } 332 }
333 333
334 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); 334 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" );
335 t.restart(); 335 t.restart();
336 stop = t.elapsed() + seconds*1000; 336 stop = t.elapsed() + seconds*1000;
337 337
338 while ( t.elapsed() < stop ) 338 while ( t.elapsed() < stop )
339 { 339 {
340 bpw.p.drawPixmap( rand()%w, rand()%h, p ); 340 bpw.p.drawPixmap( rand()%w, rand()%h, p );
341 ++loops; 341 ++loops;
342 } 342 }
343 343
344 return loops; 344 return loops;
345 345
346} 346}
347 347
348const unsigned int FILE_TEST_COUNT = 8000; 348const unsigned int FILE_TEST_COUNT = 8000;
349const unsigned int FILE_TEST_BLOCKSIZE = 1024; 349const unsigned int FILE_TEST_BLOCKSIZE = 1024;
350 350
351void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item ) 351void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item )
352{ 352{
353 QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname; 353 QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname;
354 odebug << "performing file test on " << filename << oendl; 354 odebug << "performing file test on " << filename << oendl;
355 355
356 QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename ) 356 QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename )
357 .arg( FILE_TEST_COUNT ) 357 .arg( FILE_TEST_COUNT )
358 .arg( FILE_TEST_BLOCKSIZE ); 358 .arg( FILE_TEST_BLOCKSIZE );
359 QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename ) 359 QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename )
360 .arg( FILE_TEST_COUNT ) 360 .arg( FILE_TEST_COUNT )
361 .arg( FILE_TEST_BLOCKSIZE ); 361 .arg( FILE_TEST_BLOCKSIZE );
362 ::system( "sync" ); 362 ::system( "sync" );
363 odebug << "performing file test on " << filename << oendl; 363 odebug << "performing file test on " << filename << oendl;
364 364
365 int write = 0; 365 int write = 0;
366 int read = 0; 366 int read = 0;
367 367
368 QTime time; 368 QTime time;
369 time.start(); 369 time.start();
370 if ( ::system( writeCommand ) == 0 ) 370 if ( ::system( writeCommand ) == 0 )
371 { 371 {
372 write = time.elapsed(); 372 write = time.elapsed();
373 } 373 }
374 else 374 else
375 { 375 {
376 item->setText( 1, tr( "error" ) ); 376 item->setText( 1, tr( "error" ) );
377 return; 377 return;
378 } 378 }
379 379
380 time.restart(); 380 time.restart();
381 if ( ::system( readCommand ) == 0 ) 381 if ( ::system( readCommand ) == 0 )
382 { 382 {
383 read = time.elapsed(); 383 read = time.elapsed();
384 } 384 }
385 else 385 else
386 { 386 {
387 item->setText( 1, tr( "error" ) ); 387 item->setText( 1, tr( "error" ) );
388 return; 388 return;
389 } 389 }
390 390
391 QFile::remove( filename ); 391 QFile::remove( filename );
392 double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 ); 392 double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 );
393 QString readUnit = "kB/s"; 393 QString readUnit = "kB/s";
394 if ( readSpeed > 1024 ) 394 if ( readSpeed > 1024 )
395 { 395 {
396 readSpeed /= 1024.0; 396 readSpeed /= 1024.0;
397 readUnit = "MB/s"; 397 readUnit = "MB/s";
398 } 398 }
399 double writeSpeed = FILE_TEST_COUNT / ( write / 1000.0 ); 399 double writeSpeed = FILE_TEST_COUNT / ( write / 1000.0 );
400 QString writeUnit = "kb/s"; 400 QString writeUnit = "kb/s";
401 if ( writeSpeed > 1024 ) 401 if ( writeSpeed > 1024 )
402 { 402 {
403 writeSpeed /= 1024.0; 403 writeSpeed /= 1024.0;
404 writeUnit = "MB/s"; 404 writeUnit = "MB/s";
405 } 405 }
406 item->setText( 1, QString().sprintf( "%.2f %s, %.2f %s", readSpeed, readUnit.latin1(), writeSpeed, writeUnit.latin1() ) ); 406 item->setText( 1, QString().sprintf( "%.2f %s; %.2f %s", readSpeed, readUnit.latin1(), writeSpeed, writeUnit.latin1() ) );
407 item->setOn( false ); 407 item->setOn( false );
408} 408}