author | mickeyl <mickeyl> | 2004-08-27 09:43:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-08-27 09:43:17 (UTC) |
commit | a6e7ebcee38719a9f33ede08ed4c8a364c2ecb20 (patch) (side-by-side diff) | |
tree | 1c5674ddb8de987ac8a42d6c58597684ab1e43a4 | |
parent | 2b5ae694fd875ed90c764d430891fbe4548688f2 (diff) | |
download | opie-a6e7ebcee38719a9f33ede08ed4c8a364c2ecb20.zip opie-a6e7ebcee38719a9f33ede08ed4c8a364c2ecb20.tar.gz opie-a6e7ebcee38719a9f33ede08ed4c8a364c2ecb20.tar.bz2 |
adapt unit for file benchmarks, if value too high for kb/sec
-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index f3a6561..8497c8b 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp @@ -383,7 +383,21 @@ void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item return; } QFile::remove( filename ); - item->setText( 1, QString().sprintf( "%.2f kb/s, %.2f kb/s", FILE_TEST_COUNT / ( read / 1000.0 ), FILE_TEST_COUNT / ( write / 1000.0 ) ) ); + 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 = "mb/s"; + } + item->setText( 1, QString().sprintf( "%.2f %s, %.2f %s", readSpeed, readUnit.latin1(), writeSpeed, writeUnit.latin1() ) ); item->setOn( false ); } |