summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/benchmarkinfo.cpp
authorzecke <zecke>2004-03-14 16:01:52 (UTC)
committer zecke <zecke>2004-03-14 16:01:52 (UTC)
commitf12af18557c8f376f0c6c30e80a85737ff6c592e (patch) (unidiff)
treed60806f34f4ff6af82491579e80c9ef72cd4071e /noncore/settings/sysinfo/benchmarkinfo.cpp
parent13aeeabab5f2a6262b33de83cc9559a49365e325 (diff)
downloadopie-f12af18557c8f376f0c6c30e80a85737ff6c592e.zip
opie-f12af18557c8f376f0c6c30e80a85737ff6c592e.tar.gz
opie-f12af18557c8f376f0c6c30e80a85737ff6c592e.tar.bz2
Make use of ODP
Diffstat (limited to 'noncore/settings/sysinfo/benchmarkinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 3c2c15f..2a52b00 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -48,13 +48,16 @@
48#include <stdlib.h> 48#include <stdlib.h>
49#include <math.h> 49#include <math.h>
50#if defined (__GNUC__) && (__GNUC__ < 3) 50#if defined (__GNUC__) && (__GNUC__ < 3)
51extern double round(double); 51extern double round(double);
52#endif 52#endif
53 53
54using namespace Opie::Ui;
55using namespace Opie::Core;
54extern "C" 56extern "C"
57
55{ 58{
56 void BenchFFT( void ); 59 void BenchFFT( void );
57 double dhry_main( int ); 60 double dhry_main( int );
58} 61}
59 62
60#define DHRYSTONE_RUNS 20000000 63#define DHRYSTONE_RUNS 20000000
@@ -172,18 +175,18 @@ void BenchmarkInfo::machineActivated( int index )
172 { 175 {
173 qDebug( "sysinfo: no results available." ); 176 qDebug( "sysinfo: no results available." );
174 return; 177 return;
175 } 178 }
176 QStringList::Iterator it = results->begin(); 179 QStringList::Iterator it = results->begin();
177 test_alu->setText( 2, *(it++) ); 180 test_alu->setText( 2, *(it++) );
178 test_fpu->setText( 2, *(it++) ); 181 test_fpu->setText( 2, *(it++) );
179 test_txt->setText( 2, *(it++) ); 182 test_txt->setText( 2, *(it++) );
180 test_gfx->setText( 2, *(it++) ); 183 test_gfx->setText( 2, *(it++) );
181 test_ram->setText( 2, *(it++) ); 184 test_ram->setText( 2, *(it++) );
182 test_sd->setText( 2, *(it++) ); 185 test_sd->setText( 2, *(it++) );
183 test_cf->setText( 2, *(it++) ); 186 test_cf->setText( 2, *(it++) );
184} 187}
185 188
186 189
187void BenchmarkInfo::run() 190void BenchmarkInfo::run()
188{ 191{
189 startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); 192 startButton->setText( "> Don't touch! Running Tests! Don't touch! <" );
@@ -256,23 +259,23 @@ int BenchmarkInfo::textRendering( int seconds )
256 259
257 srand( time( NULL ) ); 260 srand( time( NULL ) );
258 261
259 BenchmarkPaintWidget bpw; 262 BenchmarkPaintWidget bpw;
260 263
261 int loops = 0; 264 int loops = 0;
262 265
263 while ( t.elapsed() < stop ) 266 while ( t.elapsed() < stop )
264 { 267 {
265 int k = rand() % 9; 268 int k = rand() % 9;
266 int s = rand() % 100; 269 int s = rand() % 100;
267 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 270 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
268 bpw.p.setFont( QFont( "Vera", s ) ); 271 bpw.p.setFont( QFont( "Vera", s ) );
269 bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); 272 bpw.p.drawText( rand() % w, rand() % h, text, text.length() );
270 ++loops; 273 ++loops;
271 } 274 }
272 275
273 return loops * text.length(); 276 return loops * text.length();
274} 277}
275 278
276int BenchmarkInfo::gfxRendering( int seconds ) 279int BenchmarkInfo::gfxRendering( int seconds )
277{ 280{
278 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; 281 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 };
@@ -287,57 +290,57 @@ int BenchmarkInfo::gfxRendering( int seconds )
287 BenchmarkPaintWidget bpw; 290 BenchmarkPaintWidget bpw;
288 291
289 QTime t; 292 QTime t;
290 t.start(); 293 t.start();
291 int stop = t.elapsed() + seconds*1000; 294 int stop = t.elapsed() + seconds*1000;
292 int loops = 0; 295 int loops = 0;
293 296
294 while ( t.elapsed() < stop ) 297 while ( t.elapsed() < stop )
295 { 298 {
296 int k = rand() % 9; 299 int k = rand() % 9;
297 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 300 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
298 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); 301 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h );
299 ++loops; 302 ++loops;
300 } 303 }
301 304
302 t.restart(); 305 t.restart();
303 stop = t.elapsed() + seconds*1000; 306 stop = t.elapsed() + seconds*1000;
304 307
305 while ( t.elapsed() < stop ) 308 while ( t.elapsed() < stop )
306 { 309 {
307 int k = rand() % 9; 310 int k = rand() % 9;
308 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 311 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
309 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); 312 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 );
310 ++loops; 313 ++loops;
311 } 314 }
312 315
313 QBrush br1; 316 QBrush br1;
314 br1.setStyle( SolidPattern ); 317 br1.setStyle( SolidPattern );
315 t.restart(); 318 t.restart();
316 stop = t.elapsed() + seconds*1000; 319 stop = t.elapsed() + seconds*1000;
317 320
318 while ( t.elapsed() < stop ) 321 while ( t.elapsed() < stop )
319 { 322 {
320 int k = rand() % 9; 323 int k = rand() % 9;
321 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 324 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
322 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); 325 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 );
323 ++loops; 326 ++loops;
324 } 327 }
325 328
326 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); 329 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" );
327 t.restart(); 330 t.restart();
328 stop = t.elapsed() + seconds*1000; 331 stop = t.elapsed() + seconds*1000;
329 332
330 while ( t.elapsed() < stop ) 333 while ( t.elapsed() < stop )
331 { 334 {
332 bpw.p.drawPixmap( rand()%w, rand()%h, p ); 335 bpw.p.drawPixmap( rand()%w, rand()%h, p );
333 ++loops; 336 ++loops;
334 } 337 }
335 338
336 return loops; 339 return loops;
337 340
338} 341}
339 342
340void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item ) 343void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item )
341{ 344{
342 QTime time; 345 QTime time;
343 time.start(); 346 time.start();