summaryrefslogtreecommitdiff
authorschurig <schurig>2004-09-20 08:17:49 (UTC)
committer schurig <schurig>2004-09-20 08:17:49 (UTC)
commit399dbbe957d219ad88b0c5624654496302969cf4 (patch) (unidiff)
tree3c3a77e337ba0da03610e09ce2fcbe9cdf670cf3
parentb6b8bfb2401257d7e9fdf3919df11415fea0c977 (diff)
downloadopie-399dbbe957d219ad88b0c5624654496302969cf4.zip
opie-399dbbe957d219ad88b0c5624654496302969cf4.tar.gz
opie-399dbbe957d219ad88b0c5624654496302969cf4.tar.bz2
use ";", not "," as delimiter of the speed field's write and read speeds,
because in the result file the fields are delimited with "," as well
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
@@ -278,131 +278,131 @@ int BenchmarkInfo::textRendering( int seconds )
278 ++loops; 278 ++loops;
279 } 279 }
280 280
281 return loops * text.length(); 281 return loops * text.length();
282} 282}
283 283
284int BenchmarkInfo::gfxRendering( int seconds ) 284int BenchmarkInfo::gfxRendering( int seconds )
285{ 285{
286 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; 286 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 };
287 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; 287 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 };
288 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; 288 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 };
289 289
290 int w = QApplication::desktop()->width(); 290 int w = QApplication::desktop()->width();
291 int h = QApplication::desktop()->height(); 291 int h = QApplication::desktop()->height();
292 292
293 srand( time( NULL ) ); 293 srand( time( NULL ) );
294 294
295 BenchmarkPaintWidget bpw; 295 BenchmarkPaintWidget bpw;
296 296
297 QTime t; 297 QTime t;
298 t.start(); 298 t.start();
299 int stop = t.elapsed() + seconds*1000; 299 int stop = t.elapsed() + seconds*1000;
300 int loops = 0; 300 int loops = 0;
301 301
302 while ( t.elapsed() < stop ) 302 while ( t.elapsed() < stop )
303 { 303 {
304 int k = rand() % 9; 304 int k = rand() % 9;
305 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 305 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
306 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); 306 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h );
307 ++loops; 307 ++loops;
308 } 308 }
309 309
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}