summaryrefslogtreecommitdiff
path: root/noncore/settings
authormickeyl <mickeyl>2004-02-27 23:12:01 (UTC)
committer mickeyl <mickeyl>2004-02-27 23:12:01 (UTC)
commit99d1378aeaad7613b820d5c3b55911c77a01d7c5 (patch) (unidiff)
tree4d509df258c29f19f7d1502db185fd1b02339cba /noncore/settings
parentef5dd6301fee8abe99320d3151f4aae1b4e9e776 (diff)
downloadopie-99d1378aeaad7613b820d5c3b55911c77a01d7c5.zip
opie-99d1378aeaad7613b820d5c3b55911c77a01d7c5.tar.gz
opie-99d1378aeaad7613b820d5c3b55911c77a01d7c5.tar.bz2
ram,cf and sd seem to work now. didn't test on a PDA yet though ;)
Diffstat (limited to 'noncore/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp96
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.h7
2 files changed, 31 insertions, 72 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 3dd4121..69d8229 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -19,2 +19,3 @@
19/* OPIE */ 19/* OPIE */
20#include <opie2/ostorageinfo.h>
20#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
@@ -55,2 +56,5 @@ extern "C"
55 56
57#define BUFF_SIZE 8192
58#define FILE_SIZE 1024 * 1024 // 1Mb
59
56//=========================================================================== 60//===========================================================================
@@ -156,18 +160,11 @@ void BenchmarkInfo::run()
156 160
157 if ( test_ram->isOn() ) 161 if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA
158 { 162 {
159 t.start(); 163 performFileTest( "/tmp/benchmarkFile.dat", test_ram );
160 writeFile( "/tmp/benchmarkFile.dat" ); // /tmp is supposed to be in RAM on a PDA
161 readFile( "/tmp/benchmarkFile.dat" );
162 QFile::remove( "/tmp/benchmarkFile.dat" );
163 test_ram->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) );
164 test_ram->setOn( false );
165 } 164 }
166/* 165
167 if ( test_cf->isOn() ) 166 if ( test_cf->isOn() )
168 { 167 {
169 t.start(); 168 OStorageInfo storage;
170 benchInteger(); 169 performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf );
171 test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) );
172 test_alu->setOn( false );
173 } 170 }
@@ -176,15 +173,6 @@ void BenchmarkInfo::run()
176 { 173 {
177 t.start(); 174 OStorageInfo storage;
178 benchInteger(); 175 performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd );
179 test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) );
180 test_alu->setOn( false );
181 } 176 }
182 177
183 if ( ( which_clipb ) && ( buf.length() > 0 ) )
184 {
185 clb = QApplication::clipboard();
186 clb->setText( dt_buf + buf );
187 }
188 */
189
190 startButton->setText( tr( "&Start Tests!" ) ); 178 startButton->setText( tr( "&Start Tests!" ) );
@@ -290,8 +278,18 @@ int BenchmarkInfo::gfxRendering( int seconds )
290 278
291// ********************************************************************** 279void BenchmarkInfo::performFileTest( const QString& fname, QCheckListItem* item )
292// Read & Write 280{
293// v2.0.0 281 QTime time;
294// ********************************************************************** 282 time.start();
295#define BUFF_SIZE 8192 283 if ( writeFile( fname ) &&
296#define FILE_SIZE 1024 * 1024 // 1Mb 284 readFile( fname ) )
285 {
286 QFile::remove( fname );
287 item->setText( 1, QString( "%1 kb/sec" ).arg( QString::number( 1024.0 / ( time.elapsed() / 1000.0 ) ) ) );
288 item->setOn( false );
289 }
290 else
291 {
292 item->setText( 1, tr( "error" ) );
293 }
294}
297 295
@@ -365,43 +363,3 @@ bool BenchmarkInfo::writeFile( const QString& w_path )
365 return ( true ); 363 return ( true );
366 // ------------------------------------*/
367
368 /* ----------------------------------
369 srand( time( NULL ) );
370 364
371 FILE *fp;
372
373 for( n= 0 ; n < 40 ; n++ )
374 {
375 if (( fp = fopen( w_path, "wt" )) == NULL )
376 return( false );
377 memset( FileBuf, '\0', BUFF_SIZE+1 );
378 // ------------------------------------------ sequential write
379 for( i= 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ )
380 {
381 for( k= 0 ; k < 128 ; k++ )
382 {
383 n = rand() % 30;
384 memcpy( &FileBuf[k*8], &data[n], 32 );
385 }
386 fputs( FileBuf, fp );
387 }
388 // ------------------------------------------ random write
389 for( i= 0 ; i < 300 ; i++ )
390 {
391 memset( FileBuf, '\0', 130 );
392 len = rand() % 120 + 8;
393 for( k= 0 ; k < 16 ; k++ )
394 {
395 n = rand() % 54;
396 memcpy( &FileBuf[k*8], &data[n], 8 );
397 }
398 pos = rand() % ( FILE_SIZE / BUFF_SIZE - BUFF_SIZE );
399
400 fseek( fp, pos, SEEK_SET );
401 fputs( FileBuf, fp );
402 }
403 fclose( fp );
404 }
405 return( true );
406 -------------------------------------*/
407} 365}
diff --git a/noncore/settings/sysinfo/benchmarkinfo.h b/noncore/settings/sysinfo/benchmarkinfo.h
index 55398eb..3c5ca37 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.h
+++ b/noncore/settings/sysinfo/benchmarkinfo.h
@@ -56,8 +56,9 @@ public:
56 int gfxRendering( int ); 56 int gfxRendering( int );
57 bool writeFile( const QString& ); 57 void performFileTest( const QString& fname, QCheckListItem* item );
58 bool readFile( const QString& );
59 58
60private slots: 59private slots:
60 bool writeFile( const QString& );
61 bool readFile( const QString& );
61 void run(); 62 void run();
62
63}; 63};
64