author | mickeyl <mickeyl> | 2004-02-27 16:26:54 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-27 16:26:54 (UTC) |
commit | 557424c8b345677038e6e35aae2ada22748af904 (patch) (unidiff) | |
tree | 047afc03d6b269e56d30fd1069813d64c8413dca | |
parent | 4075bd88da2eb3f3eec78fe283023231764834b4 (diff) | |
download | opie-557424c8b345677038e6e35aae2ada22748af904.zip opie-557424c8b345677038e6e35aae2ada22748af904.tar.gz opie-557424c8b345677038e6e35aae2ada22748af904.tar.bz2 |
This patch adds a benchmark tab to SysInfo!
Available tests & Implementation Status:
-------------------------------------------
Integer Arithmetic: done
Floating Point: done
Text Rendering: done
Gfx Rendering: done
RAM Performance: in progress
SD Performance: not yet done
CF Performance: not yet done
-------------------------------------------
I will complete this on weekend by adding the last
tests and adding a comparison table for known systems :)
Have Fun!
-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.cpp | 453 | ||||
-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.h | 72 | ||||
-rw-r--r-- | noncore/settings/sysinfo/fft.c | 642 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.pro | 4 | ||||
-rw-r--r-- | pics/sysinfo/benchmarktabicon.png | bin | 0 -> 736 bytes | |||
-rw-r--r-- | pics/sysinfo/pattern.png | bin | 0 -> 6926 bytes |
7 files changed, 1173 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp new file mode 100644 index 0000000..62146f7 --- a/dev/null +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp | |||
@@ -0,0 +1,453 @@ | |||
1 | /********************************************************************** | ||
2 | ** BenchmarkInfo | ||
3 | ** | ||
4 | ** A benchmark for Qt/Embedded | ||
5 | ** | ||
6 | ** Copyright (C) 2004 Michael Lauer <mickey@vanille.de> | ||
7 | ** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp> | ||
8 | ** | ||
9 | ** This file may be distributed and/or modified under the terms of the | ||
10 | ** GNU General Public License version 2 as published by the Free Software | ||
11 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
12 | ** packaging of this file. | ||
13 | ** | ||
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
16 | ** | ||
17 | **********************************************************************/ | ||
18 | |||
19 | /* OPIE */ | ||
20 | #include <qpe/qpeapplication.h> | ||
21 | #include <qpe/qcopenvelope_qws.h> | ||
22 | #include <qpe/qpedecoration_qws.h> | ||
23 | #include <qpe/resource.h> | ||
24 | #include <qpe/config.h> | ||
25 | |||
26 | /* QT */ | ||
27 | #include <qlayout.h> | ||
28 | #include <qfiledialog.h> | ||
29 | #include <qlabel.h> | ||
30 | #include <qpainter.h> | ||
31 | #include <qdirectpainter_qws.h> | ||
32 | #include <qapplication.h> | ||
33 | #include <qpushbutton.h> | ||
34 | #include <qclipboard.h> | ||
35 | #include <qtimer.h> | ||
36 | #include <qcolor.h> | ||
37 | #include <qpushbutton.h> | ||
38 | |||
39 | /* STD */ | ||
40 | #include <stdio.h> | ||
41 | #include <time.h> | ||
42 | #include <stdlib.h> | ||
43 | |||
44 | #include "benchmarkinfo.h" | ||
45 | |||
46 | extern "C" | ||
47 | { | ||
48 | void BenchFFT( void ); | ||
49 | } | ||
50 | |||
51 | //=========================================================================== | ||
52 | |||
53 | class BenchmarkPaintWidget : public QWidget | ||
54 | { | ||
55 | public: | ||
56 | BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) | ||
57 | { | ||
58 | resize( QApplication::desktop()->size() ); | ||
59 | show(); | ||
60 | p.begin( this ); | ||
61 | }; | ||
62 | |||
63 | ~BenchmarkPaintWidget() | ||
64 | { | ||
65 | p.end(); | ||
66 | hide(); | ||
67 | }; | ||
68 | |||
69 | QPainter p; | ||
70 | }; | ||
71 | |||
72 | //=========================================================================== | ||
73 | |||
74 | BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) | ||
75 | : QWidget( parent, name, wFlags ) | ||
76 | { | ||
77 | |||
78 | setMinimumSize( 200, 150 ); | ||
79 | |||
80 | QVBoxLayout* vb = new QVBoxLayout( this ); | ||
81 | vb->setSpacing( 4 ); | ||
82 | vb->setMargin( 4 ); | ||
83 | |||
84 | tests = new QListView( this ); | ||
85 | tests->setMargin( 1 ); | ||
86 | tests->addColumn( "Tests" ); | ||
87 | tests->addColumn( "Results" ); | ||
88 | tests->setShowSortIndicator( true ); | ||
89 | |||
90 | test_alu = new QCheckListItem( tests, "1: Integer Arithmetic ", QCheckListItem::CheckBox ); | ||
91 | test_alu->setText( 1, "n/a" ); | ||
92 | test_fpu = new QCheckListItem( tests, "2: Floating Point Unit ", QCheckListItem::CheckBox ); | ||
93 | test_fpu->setText( 1, "n/a" ); | ||
94 | test_txt = new QCheckListItem( tests, "3: Text Rendering ", QCheckListItem::CheckBox ); | ||
95 | test_txt->setText( 1, "n/a" ); | ||
96 | test_gfx = new QCheckListItem( tests, "4: Gfx Rendering ", QCheckListItem::CheckBox ); | ||
97 | test_gfx->setText( 1, "n/a" ); | ||
98 | test_ram = new QCheckListItem( tests, "5: RAM Performance ", QCheckListItem::CheckBox ); | ||
99 | test_ram->setText( 1, "n/a" ); | ||
100 | test_sd = new QCheckListItem( tests, "6: SD Card Performance ", QCheckListItem::CheckBox ); | ||
101 | test_sd->setText( 1, "n/a" ); | ||
102 | test_cf = new QCheckListItem( tests, "7: CF Card Performance ", QCheckListItem::CheckBox ); | ||
103 | test_cf->setText( 1, "n/a" ); | ||
104 | |||
105 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); | ||
106 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); | ||
107 | |||
108 | vb->addWidget( tests, 2 ); | ||
109 | vb->addWidget( startButton ); | ||
110 | } | ||
111 | |||
112 | |||
113 | BenchmarkInfo::~BenchmarkInfo() | ||
114 | {} | ||
115 | |||
116 | |||
117 | void BenchmarkInfo::run() | ||
118 | { | ||
119 | startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); | ||
120 | qApp->processEvents(); | ||
121 | QTime t; | ||
122 | |||
123 | if ( test_alu->isOn() ) | ||
124 | { | ||
125 | t.start(); | ||
126 | benchInteger(); | ||
127 | test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
128 | test_alu->setOn( false ); | ||
129 | } | ||
130 | |||
131 | if ( test_fpu->isOn() ) | ||
132 | { | ||
133 | t.start(); | ||
134 | BenchFFT(); | ||
135 | test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
136 | test_fpu->setOn( false ); | ||
137 | } | ||
138 | |||
139 | if ( test_txt->isOn() ) | ||
140 | { | ||
141 | t.start(); | ||
142 | paintChar(); | ||
143 | test_txt->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
144 | test_txt->setOn( false ); | ||
145 | } | ||
146 | |||
147 | if ( test_gfx->isOn() ) | ||
148 | { | ||
149 | t.start(); | ||
150 | paintLineRect(); | ||
151 | test_gfx->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
152 | test_gfx->setOn( false ); | ||
153 | } | ||
154 | |||
155 | if ( test_ram->isOn() ) | ||
156 | { | ||
157 | t.start(); | ||
158 | writeFile( "/tmp/benchmarkFile.dat" ); // /tmp is supposed to be in RAM on a PDA | ||
159 | readFile( "/tmp/benchmarkFile.dat" ); | ||
160 | QFile::remove( "/tmp/benchmarkFile.dat" ); | ||
161 | test_ram->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
162 | test_ram->setOn( false ); | ||
163 | } | ||
164 | /* | ||
165 | if ( test_cf->isOn() ) | ||
166 | { | ||
167 | t.start(); | ||
168 | benchInteger(); | ||
169 | test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
170 | test_alu->setOn( false ); | ||
171 | } | ||
172 | |||
173 | if ( test_sd->isOn() ) | ||
174 | { | ||
175 | t.start(); | ||
176 | benchInteger(); | ||
177 | test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); | ||
178 | test_alu->setOn( false ); | ||
179 | } | ||
180 | |||
181 | if ( ( which_clipb ) && ( buf.length() > 0 ) ) | ||
182 | { | ||
183 | clb = QApplication::clipboard(); | ||
184 | clb->setText( dt_buf + buf ); | ||
185 | } | ||
186 | */ | ||
187 | |||
188 | startButton->setText( tr( "&Start Tests!" ) ); | ||
189 | } | ||
190 | |||
191 | |||
192 | void BenchmarkInfo::benchInteger() const | ||
193 | { | ||
194 | long dummy = 1; | ||
195 | |||
196 | for ( long i= 0 ; i < INT_TEST_ITERATIONS ; i++ ) | ||
197 | { | ||
198 | for ( long j= 0 ; j < INT_TEST_ITERATIONS ; j++ ) | ||
199 | { | ||
200 | for( long k= 0 ; k < INT_TEST_ITERATIONS ; k++ ) | ||
201 | { | ||
202 | long xx = ( rand() % 1000 + 111 ) * 7 / 3 + 31; | ||
203 | long yy = ( rand() % 100 + 23 ) * 11 / 7 + 17; | ||
204 | long zz = ( rand() % 100 + 47 ) * 13 / 11 - 211; | ||
205 | dummy = xx * yy / zz; | ||
206 | dummy *= 23; | ||
207 | dummy += ( xx - yy + zz ); | ||
208 | dummy -= ( xx + yy - zz ); | ||
209 | dummy *= ( xx * zz * yy ); | ||
210 | dummy /= 1 + ( xx * yy * zz ); | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | } | ||
215 | |||
216 | |||
217 | void BenchmarkInfo::paintChar() | ||
218 | { | ||
219 | int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; | ||
220 | int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; | ||
221 | int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; | ||
222 | const QString text( "Opie Benchmark Test" ); | ||
223 | |||
224 | int w = QApplication::desktop()->width(); | ||
225 | int h = QApplication::desktop()->height(); | ||
226 | |||
227 | srand( time( NULL ) ); | ||
228 | |||
229 | BenchmarkPaintWidget bpw; | ||
230 | |||
231 | for ( int i = 0; i < CHAR_TEST_ITERATIONS; ++i ) | ||
232 | { | ||
233 | int k = rand() % 9; | ||
234 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | ||
235 | bpw.p.setFont( QFont( "Vera", k*10 ) ); | ||
236 | bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | void BenchmarkInfo::paintLineRect() | ||
241 | { | ||
242 | int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; | ||
243 | int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; | ||
244 | int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; | ||
245 | |||
246 | int w = QApplication::desktop()->width(); | ||
247 | int h = QApplication::desktop()->height(); | ||
248 | |||
249 | srand( time( NULL ) ); | ||
250 | |||
251 | BenchmarkPaintWidget bpw; | ||
252 | |||
253 | for ( int i = 0; i < DRAW_TEST_ITERATIONS*3; ++i ) | ||
254 | { | ||
255 | int k = rand() % 9; | ||
256 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | ||
257 | bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); | ||
258 | } | ||
259 | |||
260 | for ( int i = 0; i < DRAW_TEST_ITERATIONS; ++i ) | ||
261 | { | ||
262 | int k = rand() % 9; | ||
263 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | ||
264 | bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); | ||
265 | } | ||
266 | |||
267 | QBrush br1; | ||
268 | br1.setStyle( SolidPattern ); | ||
269 | |||
270 | for ( int i = 0; i < DRAW_TEST_ITERATIONS*2; ++i ) | ||
271 | { | ||
272 | int k = rand() % 9; | ||
273 | br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | ||
274 | bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); | ||
275 | } | ||
276 | |||
277 | QPixmap p = Resource::loadPixmap( "pattern" ); | ||
278 | for ( int i = 0; i < DRAW_TEST_ITERATIONS; ++i ) | ||
279 | { | ||
280 | bpw.p.drawPixmap( rand()%w, rand()%h, p ); | ||
281 | } | ||
282 | |||
283 | |||
284 | } | ||
285 | |||
286 | // ********************************************************************** | ||
287 | // Read & Write | ||
288 | // v2.0.0 | ||
289 | // ********************************************************************** | ||
290 | #define BUFF_SIZE 8192 | ||
291 | #define FILE_SIZE 1024 * 1024 // 1Mb | ||
292 | |||
293 | char FileBuf[ BUFF_SIZE + 1 ]; | ||
294 | |||
295 | bool BenchmarkInfo::writeFile( const QString& w_path ) | ||
296 | { | ||
297 | int i; | ||
298 | int k; | ||
299 | int n; | ||
300 | int pos; | ||
301 | int len; | ||
302 | char *data = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 62 | ||
303 | |||
304 | |||
305 | // /*------------------------------------ | ||
306 | int w_len; | ||
307 | |||
308 | QFile writeFile( w_path ); | ||
309 | srand( time( NULL ) ); | ||
310 | |||
311 | for ( n = 0 ; n < 20 ; n++ ) | ||
312 | { | ||
313 | if ( ! writeFile.open( IO_WriteOnly ) ) | ||
314 | { | ||
315 | writeFile.close(); | ||
316 | writeFile.remove(); | ||
317 | return ( false ); | ||
318 | } | ||
319 | // ------------------------------------------ sequential write | ||
320 | for ( k = 0 ; k < 256 ; k++ ) | ||
321 | { | ||
322 | n = rand() % 30; | ||
323 | memcpy( &FileBuf[ k * 32 ], &data[ n ], 32 ); | ||
324 | } | ||
325 | |||
326 | for ( i = 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) | ||
327 | { | ||
328 | w_len = writeFile.writeBlock( FileBuf, BUFF_SIZE ); | ||
329 | if ( w_len != BUFF_SIZE ) | ||
330 | { | ||
331 | writeFile.close(); | ||
332 | writeFile.remove(); | ||
333 | return ( false ); | ||
334 | } | ||
335 | writeFile.flush(); | ||
336 | } | ||
337 | // ------------------------------------------ random write | ||
338 | for ( i = 0 ; i < 400 ; i++ ) | ||
339 | { | ||
340 | len = rand() % 90 + 4000; | ||
341 | for ( k = 0 ; k < 128 ; k++ ) | ||
342 | { | ||
343 | n = rand() % 30; | ||
344 | memcpy( &FileBuf[ k * 8 ], &data[ n ], 32 ); | ||
345 | } | ||
346 | pos = rand() % ( FILE_SIZE - BUFF_SIZE ); | ||
347 | |||
348 | writeFile.at( pos ); | ||
349 | w_len = writeFile.writeBlock( FileBuf, len ); | ||
350 | if ( w_len != len ) | ||
351 | { | ||
352 | writeFile.close(); | ||
353 | writeFile.remove(); | ||
354 | return ( false ); | ||
355 | } | ||
356 | writeFile.flush(); | ||
357 | } | ||
358 | writeFile.close(); | ||
359 | } | ||
360 | return ( true ); | ||
361 | // ------------------------------------*/ | ||
362 | |||
363 | /* ---------------------------------- | ||
364 | srand( time( NULL ) ); | ||
365 | |||
366 | FILE *fp; | ||
367 | |||
368 | for( n= 0 ; n < 40 ; n++ ) | ||
369 | { | ||
370 | if (( fp = fopen( w_path, "wt" )) == NULL ) | ||
371 | return( false ); | ||
372 | memset( FileBuf, '\0', BUFF_SIZE+1 ); | ||
373 | // ------------------------------------------ sequential write | ||
374 | for( i= 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) | ||
375 | { | ||
376 | for( k= 0 ; k < 128 ; k++ ) | ||
377 | { | ||
378 | n = rand() % 30; | ||
379 | memcpy( &FileBuf[k*8], &data[n], 32 ); | ||
380 | } | ||
381 | fputs( FileBuf, fp ); | ||
382 | } | ||
383 | // ------------------------------------------ random write | ||
384 | for( i= 0 ; i < 300 ; i++ ) | ||
385 | { | ||
386 | memset( FileBuf, '\0', 130 ); | ||
387 | len = rand() % 120 + 8; | ||
388 | for( k= 0 ; k < 16 ; k++ ) | ||
389 | { | ||
390 | n = rand() % 54; | ||
391 | memcpy( &FileBuf[k*8], &data[n], 8 ); | ||
392 | } | ||
393 | pos = rand() % ( FILE_SIZE / BUFF_SIZE - BUFF_SIZE ); | ||
394 | |||
395 | fseek( fp, pos, SEEK_SET ); | ||
396 | fputs( FileBuf, fp ); | ||
397 | } | ||
398 | fclose( fp ); | ||
399 | } | ||
400 | return( true ); | ||
401 | -------------------------------------*/ | ||
402 | } | ||
403 | |||
404 | |||
405 | bool BenchmarkInfo::readFile( const QString& r_path ) | ||
406 | { | ||
407 | int i; | ||
408 | int k; | ||
409 | int len; | ||
410 | int pos; | ||
411 | int r_len; | ||
412 | |||
413 | QFile readFile( r_path ); | ||
414 | srand( time( NULL ) ); | ||
415 | |||
416 | for ( k = 0 ; k < 200 ; k++ ) | ||
417 | { | ||
418 | if ( ! readFile.open( IO_ReadOnly ) ) | ||
419 | { | ||
420 | readFile.remove(); | ||
421 | return ( false ); | ||
422 | } | ||
423 | // ------------------------------------------ sequential read | ||
424 | readFile.at( 0 ); | ||
425 | for ( i = 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) | ||
426 | { | ||
427 | readFile.at( i * BUFF_SIZE ); | ||
428 | r_len = readFile.readBlock( FileBuf, BUFF_SIZE ); | ||
429 | if ( r_len != BUFF_SIZE ) | ||
430 | { | ||
431 | readFile.close(); | ||
432 | readFile.remove(); | ||
433 | return ( false ); | ||
434 | } | ||
435 | } | ||
436 | // ------------------------------------------ random read | ||
437 | for ( i = 0 ; i < 1000 ; i++ ) | ||
438 | { | ||
439 | len = rand() % 120 + 8; | ||
440 | pos = rand() % ( FILE_SIZE / BUFF_SIZE - BUFF_SIZE ); | ||
441 | readFile.at( pos ); | ||
442 | r_len = readFile.readBlock( FileBuf, len ); | ||
443 | if ( r_len != len ) | ||
444 | { | ||
445 | readFile.close(); | ||
446 | readFile.remove(); | ||
447 | return ( false ); | ||
448 | } | ||
449 | } | ||
450 | readFile.close(); | ||
451 | } | ||
452 | return ( true ); | ||
453 | } | ||
diff --git a/noncore/settings/sysinfo/benchmarkinfo.h b/noncore/settings/sysinfo/benchmarkinfo.h new file mode 100644 index 0000000..2c7fa40 --- a/dev/null +++ b/noncore/settings/sysinfo/benchmarkinfo.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /********************************************************************** | ||
2 | ** BenchmarkInfo | ||
3 | ** | ||
4 | ** A benchmark for Qt/Embedded | ||
5 | ** | ||
6 | ** Copyright (C) 2004 Michael Lauer <mickey@vanille.de> | ||
7 | ** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp> | ||
8 | ** | ||
9 | ** This file may be distributed and/or modified under the terms of the | ||
10 | ** GNU General Public License version 2 as published by the Free Software | ||
11 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
12 | ** packaging of this file. | ||
13 | ** | ||
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
16 | ** | ||
17 | **********************************************************************/ | ||
18 | |||
19 | #include <qwidget.h> | ||
20 | #include <qdialog.h> | ||
21 | |||
22 | class QClipboard; | ||
23 | class QCheckListItem; | ||
24 | class QPushButton; | ||
25 | class QListView; | ||
26 | |||
27 | //#define INT_TEST_ITERATIONS 50 | ||
28 | //#define CHAR_TEST_ITERATIONS 15000 | ||
29 | //#define DRAW_TEST_ITERATIONS 5000 | ||
30 | |||
31 | #define INT_TEST_ITERATIONS 50 | ||
32 | #define CHAR_TEST_ITERATIONS 15000 | ||
33 | #define DRAW_TEST_ITERATIONS 5000 | ||
34 | |||
35 | class BenchmarkInfo : public QWidget | ||
36 | { | ||
37 | Q_OBJECT | ||
38 | |||
39 | public: | ||
40 | BenchmarkInfo( QWidget *parent = 0, const char *name = 0, int wFlags = 0 ); | ||
41 | ~BenchmarkInfo(); | ||
42 | |||
43 | QCheckListItem* test_alu; | ||
44 | QCheckListItem* test_fpu; | ||
45 | QCheckListItem* test_txt; | ||
46 | QCheckListItem* test_gfx; | ||
47 | QCheckListItem* test_ram; | ||
48 | QCheckListItem* test_sd; | ||
49 | QCheckListItem* test_cf; | ||
50 | |||
51 | bool main_rd; | ||
52 | bool main_wt; | ||
53 | bool sd_rd; | ||
54 | bool sd_wt; | ||
55 | bool cf_rd; | ||
56 | bool cf_wt; | ||
57 | |||
58 | QClipboard* clb; | ||
59 | |||
60 | QListView* tests; | ||
61 | QPushButton* startButton; | ||
62 | |||
63 | void benchInteger() const; | ||
64 | void paintChar(); | ||
65 | void paintLineRect(); | ||
66 | bool writeFile( const QString& ); | ||
67 | bool readFile( const QString& ); | ||
68 | |||
69 | private slots: | ||
70 | void run(); | ||
71 | |||
72 | }; | ||
diff --git a/noncore/settings/sysinfo/fft.c b/noncore/settings/sysinfo/fft.c new file mode 100644 index 0000000..01a1b26 --- a/dev/null +++ b/noncore/settings/sysinfo/fft.c | |||
@@ -0,0 +1,642 @@ | |||
1 | |||
2 | // ****************************************************************** | ||
3 | // Copyright (c) 2002- Satoshi, All Rights Reserved. | ||
4 | // | ||
5 | // This program is free software; you can redistribute it and/or | ||
6 | // modify it under the terms of the GNU General Public License | ||
7 | // as published by the Free Software Foundation; either version 2 | ||
8 | // of the License, or (at your option) any later version. | ||
9 | // | ||
10 | // This program is distributed in the hope that it will be useful, | ||
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | // GNU General Public License for more details. | ||
14 | // | ||
15 | // You should have received a copy of the GNU General Public License | ||
16 | // along with this program; if not, write to the Free Software | ||
17 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | // | ||
19 | // | ||
20 | // Author : Satoshi ( af230533@im07.alpha-net.ne.jp ) | ||
21 | // ****************************************************************** | ||
22 | |||
23 | //*********************************************************************** | ||
24 | // ¹â®¥Õ¡¼¥ê¥¨ÊÑ´¹¡Ê£Æ£Æ£Ô¡Ë | ||
25 | // ¹¹¤Ë¥¹¥Ô¡¼¥É¡¦¥¢¥Ã¥×¤¹¤ë¤Ë¤Ï£Ã£Ï£Ó¤ò¸ÇÄê¤Ç»ý¤Ä¤³¤È¡ª | ||
26 | // | ||
27 | // Copyright (C) Satoshi 1994-2002 All rights reserved. | ||
28 | // *********************************************************************** | ||
29 | |||
30 | #include <math.h> | ||
31 | |||
32 | #define FFT_TEST_COUNT 500 // Bench FFT | ||
33 | |||
34 | // ----------------------------------------------------- FFT | ||
35 | #define OBJ_DATA_COUNT 128 | ||
36 | #define OBJ_DATA_SISU 7 // 128 = 2 ** 7 | ||
37 | #define OBJ_DATA_SLIDE 1 | ||
38 | |||
39 | #define FFT_TRN 1 | ||
40 | #define IFFT_TRN -1 | ||
41 | |||
42 | typedef struct _fft { | ||
43 | int N; // ¥Ç¥¸¥¿¥ë¡¦¥Ç¡¼¥¿·ï¿ô | ||
44 | int r; // N = 2^r | ||
45 | double* result_A; // ¥µ¥ó¥×¥ê¥ó¥°¥Ç¡¼¥¿¤ò¤³¤³¤Ë¥»¥Ã¥È¤¹¤ë | ||
46 | // cos À®Ê¬¡Äµá¤á¤ë¥¹¥Ú¥¯¥È¥ëÀ®Ê¬¤Î¿ôʬ¤ÎÎΰ褬ɬÍ× | ||
47 | double* result_B; // sin À®Ê¬¡Äµá¤á¤ë¥¹¥Ú¥¯¥È¥ëÀ®Ê¬¤Î¿ôʬ¤ÎÎΰ褬ɬÍ× | ||
48 | } FFT; | ||
49 | #define FFT_SIZE sizeof( FFT ) | ||
50 | |||
51 | |||
52 | void digital_fft( FFT* fft ); | ||
53 | |||
54 | |||
55 | double SpectA[OBJ_DATA_COUNT]; | ||
56 | double SpectB[OBJ_DATA_COUNT]; | ||
57 | |||
58 | double TestData[] = { | ||
59 | 0.998795456205172405, | ||
60 | 0.995184726672196929, | ||
61 | 0.146735474455360860, | ||
62 | 0.098217140329559660, | ||
63 | 0.980784545503230431, | ||
64 | 0.970031253194543974, | ||
65 | 0.956940335252408824, | ||
66 | -0.857728610000272118, | ||
67 | -0.831465612302545236, | ||
68 | -0.803205431480644943, | ||
69 | -0.774010453362736882, | ||
70 | -0.747954125354958995, | ||
71 | -0.707116781186547351, | ||
72 | -0.671125754847018219, | ||
73 | -0.634394284163645266, | ||
74 | -0.594619304492433024, | ||
75 | -0.555545233019601845, | ||
76 | 0.941544045483020806, | ||
77 | 0.923879532511286738, | ||
78 | 0.903989293123443338, | ||
79 | 0.881541264344545050, | ||
80 | 0.857728610000272118, | ||
81 | 0.831469612544545236, | ||
82 | 0.803207531420452543, | ||
83 | 0.773010453362736882, | ||
84 | 0.740451125354958995, | ||
85 | 0.707106781186547351, | ||
86 | -0.974034153194543974, | ||
87 | -0.956940335732208824, | ||
88 | -0.944144065183020806, | ||
89 | -0.923211532511286738, | ||
90 | -0.905989293123443338, | ||
91 | -0.881112264348355050, | ||
92 | -0.857728610000272118, | ||
93 | 0.671558954847018219, | ||
94 | 0.049167674327417023, | ||
95 | -0.001212000000001049, | ||
96 | -0.998791456205172405, | ||
97 | -0.995214726672196929, | ||
98 | -0.989176509964781014, | ||
99 | -0.980782180403230431, | ||
100 | -0.974034153194543974, | ||
101 | -0.956940335732208824, | ||
102 | -0.944144065183020806, | ||
103 | -0.923211532511286738, | ||
104 | -0.905989293123443338, | ||
105 | 0.803207531420452543, | ||
106 | 0.773010453362736882, | ||
107 | 0.740451125354958995, | ||
108 | 0.707106781186547351, | ||
109 | 0.671558954847018219, | ||
110 | 0.989576509964781014, | ||
111 | 0.980784545503230431, | ||
112 | 0.970031253194543974, | ||
113 | 0.654634123783645266, | ||
114 | 0.634646284163645266, | ||
115 | 0.595624504492433024, | ||
116 | 0.555570245019601845, | ||
117 | 0.514442744193221328, | ||
118 | 0.471356736825997198, | ||
119 | 0.424551093430281585, | ||
120 | 0.314683432365089171, | ||
121 | -0.881112264348355050, | ||
122 | -0.857728610000272118, | ||
123 | -0.831465612302545236, | ||
124 | -0.803205431480644943, | ||
125 | -0.774010453362736882, | ||
126 | -0.747954125354958995, | ||
127 | -0.707116781186547351, | ||
128 | -0.671125754847018219, | ||
129 | -0.634394284163645266, | ||
130 | -0.594619304492433024, | ||
131 | -0.555545233019601845, | ||
132 | -0.514102744193221328, | ||
133 | -0.477396736825997198, | ||
134 | -0.477555093430281585, | ||
135 | -0.387688432365089171, | ||
136 | -0.335879853392219440, | ||
137 | -0.295878677254461665, | ||
138 | 0.903989293123443338, | ||
139 | 0.881541264344545050, | ||
140 | 0.857728610000272118, | ||
141 | 0.831469612544545236, | ||
142 | 0.803207531420452543, | ||
143 | 0.773010453362736882, | ||
144 | 0.740451125354958995, | ||
145 | -0.242980179903263122, | ||
146 | -0.195057822016127443, | ||
147 | -0.146775474455360860, | ||
148 | -0.098897540329559660, | ||
149 | -0.042866864327417023, | ||
150 | 0.998795456205172405, | ||
151 | 0.995184726672196929, | ||
152 | 0.989576509964781014, | ||
153 | 0.980784545503230431, | ||
154 | 0.970031253194543974, | ||
155 | 0.956940335252408824, | ||
156 | 0.941544045483020806, | ||
157 | 0.923879532511286738, | ||
158 | -0.001212000000001049, | ||
159 | -0.998791456205172405, | ||
160 | -0.995214726672196929, | ||
161 | -0.989176509964781014, | ||
162 | -0.980782180403230431, | ||
163 | -0.974034153194543974, | ||
164 | 0.707106781186547351, | ||
165 | 0.671558954847018219, | ||
166 | 0.654634123783645266, | ||
167 | 0.634646284163645266, | ||
168 | 0.595624504492433024, | ||
169 | 0.555570245019601845, | ||
170 | 0.514442744193221328, | ||
171 | 0.471356736825997198, | ||
172 | 0.424551093430281585, | ||
173 | 0.314683432365089171, | ||
174 | 0.336441853392219440, | ||
175 | 0.290284654254461665, | ||
176 | 0.242980479903263122, | ||
177 | 0.195094322016127443, | ||
178 | 0.146735474455360860, | ||
179 | 0.098217140329559660, | ||
180 | 0.049167674327417023, | ||
181 | -0.956940335732208824, | ||
182 | -0.944144065183020806, | ||
183 | -0.923211532511286738, | ||
184 | -0.905989293123443338, | ||
185 | -0.881112264348355050, | ||
186 | -0.514102744193221328, | ||
187 | -0.477396736825997198, | ||
188 | -0.477555093430281585, | ||
189 | -0.387688432365089171, | ||
190 | -0.335879853392219440, | ||
191 | -0.295878677254461665, | ||
192 | -0.242980179903263122, | ||
193 | -0.195057822016127443, | ||
194 | -0.146775474455360860, | ||
195 | -0.098897540329559660, | ||
196 | -0.042866864327417023, | ||
197 | 0.998795456205172405, | ||
198 | 0.995184726672196929, | ||
199 | 0.989576509964781014, | ||
200 | 0.654634123783645266, | ||
201 | 0.634646284163645266, | ||
202 | 0.595624504492433024, | ||
203 | 0.555570245019601845, | ||
204 | 0.514442744193221328, | ||
205 | -0.001212000000001049, | ||
206 | -0.998791456205172405, | ||
207 | -0.995214726672196929, | ||
208 | -0.989176509964781014, | ||
209 | -0.980782180403230431, | ||
210 | -0.831465612302545236, | ||
211 | -0.803205431480644943, | ||
212 | -0.774010453362736882, | ||
213 | -0.747954125354958995, | ||
214 | -0.707116781186547351, | ||
215 | -0.671125754847018219, | ||
216 | 0.471356736825997198, | ||
217 | 0.424551093430281585, | ||
218 | 0.314683432365089171, | ||
219 | 0.336441853392219440, | ||
220 | 0.740451125354958995, | ||
221 | 0.707106781186547351, | ||
222 | 0.903989293123443338, | ||
223 | 0.471356736825997198, | ||
224 | 0.998795456205172405, | ||
225 | 0.995184726672196929, | ||
226 | 0.956940335252408824, | ||
227 | 0.941544045483020806, | ||
228 | 0.923879532511286738, | ||
229 | 0.903989293123443338, | ||
230 | 0.881541264344545050, | ||
231 | 0.857728610000272118, | ||
232 | 0.831469612544545236, | ||
233 | 0.336441853392219440, | ||
234 | 0.290284654254461665, | ||
235 | 0.242980479903263122, | ||
236 | 0.195094322016127443, | ||
237 | 0.146735474455360860, | ||
238 | 0.098217140329559660, | ||
239 | 0.049167674327417023, | ||
240 | -0.001212000000001049, | ||
241 | -0.998791456205172405, | ||
242 | -0.995214726672196929, | ||
243 | -0.989176509964781014, | ||
244 | -0.980782180403230431, | ||
245 | -0.974034153194543974, | ||
246 | -0.956940335732208824, | ||
247 | -0.944144065183020806, | ||
248 | -0.923211532511286738, | ||
249 | -0.905989293123443338, | ||
250 | 0.803207531420452543, | ||
251 | 0.773010453362736882, | ||
252 | 0.740451125354958995, | ||
253 | 0.707106781186547351, | ||
254 | 0.671558954847018219, | ||
255 | 0.989576509964781014, | ||
256 | 0.980784545503230431, | ||
257 | 0.970031253194543974, | ||
258 | 0.654634123783645266, | ||
259 | 0.634646284163645266, | ||
260 | 0.595624504492433024, | ||
261 | 0.555570245019601845, | ||
262 | 0.514442744193221328, | ||
263 | 0.471356736825997198, | ||
264 | 0.424551093430281585, | ||
265 | 0.314683432365089171, | ||
266 | -0.881112264348355050, | ||
267 | -0.857728610000272118, | ||
268 | -0.831465612302545236, | ||
269 | -0.803205431480644943, | ||
270 | -0.774010453362736882, | ||
271 | -0.747954125354958995, | ||
272 | -0.707116781186547351, | ||
273 | -0.671125754847018219, | ||
274 | -0.634394284163645266, | ||
275 | -0.594619304492433024, | ||
276 | -0.555545233019601845, | ||
277 | -0.514102744193221328, | ||
278 | -0.477396736825997198, | ||
279 | -0.477555093430281585, | ||
280 | -0.387688432365089171, | ||
281 | -0.335879853392219440, | ||
282 | -0.295878677254461665, | ||
283 | 0.903989293123443338, | ||
284 | 0.881541264344545050, | ||
285 | 0.857728610000272118, | ||
286 | 0.831469612544545236, | ||
287 | 0.803207531420452543, | ||
288 | 0.773010453362736882, | ||
289 | 0.740451125354958995, | ||
290 | -0.242980179903263122, | ||
291 | -0.195057822016127443, | ||
292 | -0.146775474455360860, | ||
293 | -0.098897540329559660, | ||
294 | -0.042866864327417023, | ||
295 | 0.998795456205172405, | ||
296 | 0.995184726672196929, | ||
297 | 0.989576509964781014, | ||
298 | 0.980784545503230431, | ||
299 | 0.970031253194543974, | ||
300 | 0.956940335252408824, | ||
301 | 0.941544045483020806, | ||
302 | 0.923879532511286738, | ||
303 | -0.001212000000001049, | ||
304 | -0.998791456205172405, | ||
305 | -0.995214726672196929, | ||
306 | -0.989176509964781014, | ||
307 | -0.980782180403230431, | ||
308 | -0.974034153194543974, | ||
309 | 0.707106781186547351, | ||
310 | 0.671558954847018219, | ||
311 | 0.654634123783645266, | ||
312 | 0.634646284163645266, | ||
313 | 0.595624504492433024, | ||
314 | 0.555570245019601845, | ||
315 | 0.514442744193221328, | ||
316 | 0.471356736825997198, | ||
317 | 0.424551093430281585, | ||
318 | 0.314683432365089171, | ||
319 | 0.336441853392219440, | ||
320 | 0.290284654254461665, | ||
321 | 0.242980479903263122, | ||
322 | 0.195094322016127443, | ||
323 | 0.146735474455360860, | ||
324 | 0.098217140329559660, | ||
325 | 0.049167674327417023, | ||
326 | -0.956940335732208824, | ||
327 | -0.944144065183020806, | ||
328 | -0.923211532511286738, | ||
329 | -0.905989293123443338, | ||
330 | -0.881112264348355050, | ||
331 | -0.514102744193221328, | ||
332 | -0.477396736825997198, | ||
333 | -0.477555093430281585, | ||
334 | -0.387688432365089171, | ||
335 | -0.335879853392219440, | ||
336 | -0.295878677254461665, | ||
337 | -0.242980179903263122, | ||
338 | -0.195057822016127443, | ||
339 | -0.146775474455360860, | ||
340 | -0.098897540329559660, | ||
341 | -0.042866864327417023, | ||
342 | 0.998795456205172405, | ||
343 | 0.995184726672196929, | ||
344 | 0.989576509964781014, | ||
345 | 0.980784545503230431, | ||
346 | 0.290284654254461665, | ||
347 | 0.242980479903263122, | ||
348 | 0.195094322016127443, | ||
349 | 0.146735474455360860, | ||
350 | 0.098217140329559660, | ||
351 | 0.049167674327417023, | ||
352 | -0.634394284163645266, | ||
353 | -0.594619304492433024, | ||
354 | -0.555545233019601845, | ||
355 | -0.514102744193221328, | ||
356 | -0.477396736825997198, | ||
357 | -0.477555093430281585, | ||
358 | -0.387688432365089171, | ||
359 | -0.335879853392219440, | ||
360 | -0.295878677254461665, | ||
361 | -0.242980179903263122, | ||
362 | -0.195057822016127443, | ||
363 | -0.146775474455360860, | ||
364 | -0.098897540329559660, | ||
365 | -0.042866864327417023, | ||
366 | 0.595624504492433024, | ||
367 | 0.555570245019601845, | ||
368 | 0.514442744193221328, | ||
369 | -0.001212000000001049, | ||
370 | -0.998791456205172405, | ||
371 | -0.995214726672196929, | ||
372 | -0.989176509964781014, | ||
373 | 0.881541264344545050, | ||
374 | 0.857728610000272118, | ||
375 | 0.471356736825997198, | ||
376 | 0.424551093430281585, | ||
377 | 0.314683432365089171, | ||
378 | 0.336441853392219440, | ||
379 | 0.290284654254461665, | ||
380 | 0.098217140329559660, | ||
381 | 0.049167674327417023, | ||
382 | -0.634394284163645266, | ||
383 | -0.594619304492433024, | ||
384 | -0.555545233019601845, | ||
385 | -0.974034153194543974, | ||
386 | -0.956940335732208824, | ||
387 | -0.944144065183020806, | ||
388 | -0.923211532511286738, | ||
389 | -0.905989293123443338, | ||
390 | -0.881112264348355050, | ||
391 | -0.857728610000272118, | ||
392 | -0.831465612302545236, | ||
393 | 0.923879532511286738, | ||
394 | 0.903989293123443338, | ||
395 | 0.881541264344545050, | ||
396 | 0.857728610000272118, | ||
397 | 0.831469612544545236, | ||
398 | 0.803207531420452543, | ||
399 | 0.773010453362736882, | ||
400 | 0.970031253194543974, | ||
401 | 0.956940335252408824, | ||
402 | -0.857728610000272118, | ||
403 | -0.831465612302545236, | ||
404 | -0.803205431480644943, | ||
405 | -0.774010453362736882, | ||
406 | -0.747954125354958995, | ||
407 | -0.707116781186547351, | ||
408 | -0.671125754847018219, | ||
409 | -0.634394284163645266, | ||
410 | -0.594619304492433024, | ||
411 | -0.555545233019601845, | ||
412 | 0.941544045483020806, | ||
413 | 0.923879532511286738, | ||
414 | 0.903989293123443338, | ||
415 | 0.881541264344545050, | ||
416 | 0.857728610000272118, | ||
417 | 0.831469612544545236, | ||
418 | 0.803207531420452543, | ||
419 | 0.773010453362736882, | ||
420 | 0.740451125354958995, | ||
421 | 0.707106781186547351, | ||
422 | -0.974034153194543974, | ||
423 | -0.956940335732208824, | ||
424 | -0.944144065183020806, | ||
425 | -0.923211532511286738, | ||
426 | -0.905989293123443338, | ||
427 | -0.881112264348355050, | ||
428 | -0.857728610000272118, | ||
429 | 0.671558954847018219, | ||
430 | 0.654634123783645266, | ||
431 | 0.634646284163645266, | ||
432 | 0.595624504492433024, | ||
433 | 0.555570245019601845, | ||
434 | 0.514442744193221328, | ||
435 | -0.001212000000001049, | ||
436 | -0.998791456205172405, | ||
437 | -0.995214726672196929, | ||
438 | -0.989176509964781014, | ||
439 | -0.980782180403230431, | ||
440 | -0.831465612302545236, | ||
441 | -0.803205431480644943, | ||
442 | -0.774010453362736882, | ||
443 | -0.747954125354958995, | ||
444 | -0.707116781186547351, | ||
445 | -0.671125754847018219, | ||
446 | 0.471356736825997198, | ||
447 | 0.424551093430281585, | ||
448 | 0.314683432365089171, | ||
449 | 0.336441853392219440, | ||
450 | 0.290284654254461665, | ||
451 | 0.242980479903263122, | ||
452 | 0.195094322016127443, | ||
453 | 0.146735474455360860, | ||
454 | 0.098217140329559660, | ||
455 | 0.049167674327417023, | ||
456 | -0.634394284163645266, | ||
457 | -0.594619304492433024, | ||
458 | -0.555545233019601845, | ||
459 | -0.514102744193221328, | ||
460 | -0.477396736825997198, | ||
461 | -0.477555093430281585, | ||
462 | -0.387688432365089171, | ||
463 | -0.335879853392219440, | ||
464 | -0.295878677254461665, | ||
465 | -0.242980179903263122, | ||
466 | -0.195057822016127443, | ||
467 | -0.146775474455360860, | ||
468 | -0.098897540329559660, | ||
469 | -0.042866864327417023, | ||
470 | 0.595624504492433024, | ||
471 | 0.555570245019601845, | ||
472 | 0.514442744193221328, | ||
473 | -0.001212000000001049, | ||
474 | -0.998791456205172405, | ||
475 | -0.995214726672196929, | ||
476 | -0.989176509964781014, | ||
477 | 0.881541264344545050, | ||
478 | 0.857728610000272118, | ||
479 | 0.471356736825997198, | ||
480 | 0.424551093430281585, | ||
481 | 0.314683432365089171, | ||
482 | 0.336441853392219440, | ||
483 | 0.290284654254461665, | ||
484 | 0.098217140329559660, | ||
485 | 0.049167674327417023, | ||
486 | -0.634394284163645266, | ||
487 | -0.594619304492433024, | ||
488 | -0.555545233019601845, | ||
489 | -0.974034153194543974, | ||
490 | -0.956940335732208824, | ||
491 | 0.956940335252408824, | ||
492 | 0.941544045483020806, | ||
493 | 0.923879532511286738, | ||
494 | 0.903989293123443338, | ||
495 | 0.881541264344545050, | ||
496 | 0.857728610000272118, | ||
497 | 0.831469612544545236, | ||
498 | 0.336441853392219440, | ||
499 | 0.290284654254461665, | ||
500 | 0.242980479903263122, | ||
501 | 0.195094322016127443, | ||
502 | -0.944144065183020806, | ||
503 | -0.923211532511286738, | ||
504 | -0.905989293123443338, | ||
505 | -0.881112264348355050, | ||
506 | -0.857728610000272118, | ||
507 | -0.831465612302545236, | ||
508 | 0.923879532511286738, | ||
509 | 0.903989293123443338, | ||
510 | 0.881541264344545050, | ||
511 | 0.857728610000272118, | ||
512 | 0.831469612544545236, | ||
513 | 0.803207531420452543, | ||
514 | 0.773010453362736882, | ||
515 | 0.740451125354958995, | ||
516 | 0.707106781186547351, | ||
517 | 0.903989293123443338, | ||
518 | 0.471356736825997198, | ||
519 | }; | ||
520 | |||
521 | |||
522 | void BenchFFT( void ) | ||
523 | { | ||
524 | int i; | ||
525 | int k; | ||
526 | FFT fft; | ||
527 | |||
528 | fft.N = OBJ_DATA_COUNT; | ||
529 | fft.r = OBJ_DATA_SISU; | ||
530 | fft.result_A = SpectA; | ||
531 | fft.result_B = SpectB; | ||
532 | |||
533 | for ( i= 0 ; i < FFT_TEST_COUNT ; i++ ) | ||
534 | { | ||
535 | for( k= 0 ; k < fft.N ; k++ ) | ||
536 | { | ||
537 | fft.result_A[k] = TestData[i+k]; | ||
538 | } | ||
539 | digital_fft( &fft ); | ||
540 | } | ||
541 | return; | ||
542 | } | ||
543 | |||
544 | |||
545 | |||
546 | void digital_fft( FFT* fft ) | ||
547 | { | ||
548 | int col; // ¡ÖÎó¡×ÈÖ¹æ | ||
549 | int g; // ¥°¥ë¡¼¥×ÈÖ¹æ | ||
550 | int i; // ¥°¥ë¡¼¥×¤Ç¹Ô¤¦Ê£ÁǾ軻²ó¿ô | ||
551 | int group_count; // ²¿¥°¥ë¡¼¥×¸ºß¤¹¤ë¤« | ||
552 | int group_item; // ¥°¥ë¡¼¥×Æâ¤Ë¤¤¤¯¤Ä¤ÎÍ×ÁǤ¬Â¸ºß¤¹¤ë¤« | ||
553 | int mul_count; // Ê£ÁǾ軻²ó¿ô | ||
554 | int pair_plus; // ¥Ð¥¿¥Õ¥é¥¤±é»»¤Çµá¤á¤¿¥Ç¡¼¥¿¤ÎÂФˤʤëÈÖ¹æ¤Ë¤¹ÃÍ | ||
555 | int pair1; // ¥Ð¥¿¥Õ¥é¥¤±é»»¤Çµá¤á¤ë£±¤ÄÌܤÎÈÖ¹æ | ||
556 | int pair2; // ¥Ð¥¿¥Õ¥é¥¤±é»»¤Çµá¤á¤ë£²¤ÄÌܤÎÈÖ¹æ | ||
557 | int j; | ||
558 | int k; | ||
559 | int w; // ¥Ó¥Ã¥È¤òȿž¤·¤¿·ë²Ì | ||
560 | int bit; | ||
561 | int mask; | ||
562 | int set; | ||
563 | double radian; | ||
564 | double rad; | ||
565 | double wk_cos; | ||
566 | double wk_sin; | ||
567 | double wk_A; | ||
568 | double wk_B; | ||
569 | |||
570 | // ---------------------------------------------- ¥Ç¡¼¥¿½é´üÀßÄê | ||
571 | for ( i= 0 ; i < fft->N ; i++ ) | ||
572 | { | ||
573 | fft->result_B[i] = 0; | ||
574 | } | ||
575 | |||
576 | group_count = 1; | ||
577 | mul_count = fft->N / 2; | ||
578 | pair_plus = fft->N / 2; | ||
579 | radian = 2 * M_PI / fft->N; | ||
580 | // --------------------------------------------- £ò²ó¡ÖÎó¡×·×»»¤ò¹Ô¤¦ | ||
581 | for ( col= 0 ; col < fft->r ; col++ ) | ||
582 | { | ||
583 | rad = 0.0; | ||
584 | // ----------------------------------------- ¥°¥ë¡¼¥×¤Ç¹Ô¤¦Ê£ÁǾ軻²ó¿ô | ||
585 | for ( i= 0 ; i < mul_count ; i++ ) | ||
586 | { | ||
587 | wk_cos = cos( rad ); | ||
588 | wk_sin = sin( rad ); | ||
589 | rad += radian; | ||
590 | |||
591 | group_item = mul_count + mul_count; | ||
592 | pair1 = i; | ||
593 | |||
594 | // ------------------------------------ ¥°¥ë¡¼¥×¤Î¿ôʬ¹Ô¤¦ | ||
595 | for ( g= 0 ; g < group_count ; g++ ) | ||
596 | { | ||
597 | // -------------------------------- ¡ÖÎó¡×·×»»¤ÎÂФˤʤë¤â¤¦£±¤Ä¤ÎÈÖ¹æ¤òµá¤á¤ë | ||
598 | pair2 = pair1 + pair_plus; | ||
599 | |||
600 | wk_A = fft->result_A[pair1] - fft->result_A[pair2]; | ||
601 | wk_B = fft->result_B[pair1] - fft->result_B[pair2]; | ||
602 | fft->result_A[pair1] = fft->result_A[pair1] + fft->result_A[pair2]; | ||
603 | fft->result_B[pair1] = fft->result_B[pair1] + fft->result_B[pair2]; | ||
604 | fft->result_A[pair2] = wk_cos * wk_A + wk_sin * wk_B; | ||
605 | fft->result_B[pair2] = wk_cos * wk_B - wk_sin * wk_A; | ||
606 | |||
607 | // -------------------------------- ¼¡¤Î¥°¥ë¡¼¥×¤ÎÀèƬ°ÌÃÖ¤ÎÈÖ¹æ¤ò¥»¥Ã¥È | ||
608 | pair1 += group_item; | ||
609 | } | ||
610 | } | ||
611 | group_count += group_count; // ¥°¥ë¡¼¥×¿ô¤Ï¡ÖÎó¡×Ëè¤Ë£²ÇܤËÁý¤¨¤Æ¤¤¤¯ | ||
612 | mul_count /= 2; // ¥°¥ë¡¼¥×¤Ç¹Ô¤¦Ê£ÁǾ軻²ó¿ô¤Ï¡ÖÎó¡×Ëè¤Ë£±¡¿£²¤Ë¤Ê¤ë | ||
613 | pair_plus /= 2; // ÂФˤʤë¥Ç¡¼¥¿¤Î°ÌÃ֤ϡÖÎó¡×Ëè¤Ë£±¡¿£²¤Ë¤Ê¤ë | ||
614 | radian += radian; | ||
615 | } | ||
616 | |||
617 | // --------------------------------------------- ¥Ç¡¼¥¿¤Î¥Ó¥Ã¥È½ç¤ò¸µ¤ËÌ᤹ | ||
618 | for ( i= 0 ; i < fft->N - 1 ; i++ ) | ||
619 | { | ||
620 | mask = 1; // ¥Á¥§¥Ã¥¯¤¹¤ë¥Ó¥Ã¥È | ||
621 | set = 1 << ( fft->r-1 ); // ( fft->r-1 ) ʬº¸¤Ø¥·¥Õ¥È | ||
622 | w = 0; | ||
623 | |||
624 | for ( j= 0, k= fft->r ; k > 0 ; j++, k-- ) | ||
625 | { | ||
626 | bit = i & mask; | ||
627 | if ( bit ) | ||
628 | w |= set; | ||
629 | mask <<= 1; | ||
630 | set >>= 1; | ||
631 | } | ||
632 | if ( w <= i ) // update 1994.04.02 Á´¥Ç¡¼¥¿¤ò¥ê¥Ð¡¼¥¹¤·¤Æ¤¤¤¿¤¿¤á¸µ¤ËÌá¤Ã¤Æ¤¤¤¿ | ||
633 | continue; | ||
634 | |||
635 | wk_A = fft->result_A[i]; | ||
636 | wk_B = fft->result_B[i]; | ||
637 | fft->result_A[i] = fft->result_A[w]; | ||
638 | fft->result_A[w] = wk_A; | ||
639 | fft->result_B[i] = fft->result_B[w]; | ||
640 | fft->result_B[w] = wk_B; | ||
641 | } | ||
642 | } | ||
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp index 5f7b527..fda6352 100644 --- a/noncore/settings/sysinfo/sysinfo.cpp +++ b/noncore/settings/sysinfo/sysinfo.cpp | |||
@@ -28,4 +28,5 @@ | |||
28 | #include "processinfo.h" | 28 | #include "processinfo.h" |
29 | #include "modulesinfo.h" | 29 | #include "modulesinfo.h" |
30 | #include "benchmarkinfo.h" | ||
30 | #include "versioninfo.h" | 31 | #include "versioninfo.h" |
31 | #include "sysinfo.h" | 32 | #include "sysinfo.h" |
@@ -53,4 +54,5 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) | |||
53 | OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); | 54 | OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); |
54 | lay->addWidget( tab ); | 55 | lay->addWidget( tab ); |
56 | |||
55 | tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") ); | 57 | tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") ); |
56 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 58 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
@@ -63,4 +65,5 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) | |||
63 | tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr("Modules") ); | 65 | tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr("Modules") ); |
64 | } | 66 | } |
67 | tab->addTab( new BenchmarkInfo( tab ), "sysinfo/benchmarktabicon", tr( "Benchmark" ) ); | ||
65 | tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); | 68 | tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); |
66 | 69 | ||
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro index 3ba4266..4baae12 100644 --- a/noncore/settings/sysinfo/sysinfo.pro +++ b/noncore/settings/sysinfo/sysinfo.pro | |||
@@ -7,4 +7,5 @@ HEADERS = memory.h \ | |||
7 | modulesinfo.h \ | 7 | modulesinfo.h \ |
8 | detail.h \ | 8 | detail.h \ |
9 | benchmarkinfo.h \ | ||
9 | versioninfo.h \ | 10 | versioninfo.h \ |
10 | sysinfo.h | 11 | sysinfo.h |
@@ -17,4 +18,5 @@ SOURCES = main.cpp \ | |||
17 | modulesinfo.cpp \ | 18 | modulesinfo.cpp \ |
18 | detail.cpp \ | 19 | detail.cpp \ |
20 | benchmarkinfo.cpp fft.c \ | ||
19 | versioninfo.cpp \ | 21 | versioninfo.cpp \ |
20 | sysinfo.cpp | 22 | sysinfo.cpp |
@@ -22,5 +24,5 @@ SOURCES = main.cpp \ | |||
22 | INCLUDEPATH += $(OPIEDIR)/include | 24 | INCLUDEPATH += $(OPIEDIR)/include |
23 | DEPENDPATH += $(OPIEDIR)/include | 25 | DEPENDPATH += $(OPIEDIR)/include |
24 | LIBS += -lqpe -lopiecore2 -lopieui2 | 26 | LIBS += -lqpe -lopiecore2 -lopieui2 |
25 | 27 | ||
26 | TARGET = sysinfo | 28 | TARGET = sysinfo |
diff --git a/pics/sysinfo/benchmarktabicon.png b/pics/sysinfo/benchmarktabicon.png new file mode 100644 index 0000000..356b962 --- a/dev/null +++ b/pics/sysinfo/benchmarktabicon.png | |||
Binary files differ | |||
diff --git a/pics/sysinfo/pattern.png b/pics/sysinfo/pattern.png new file mode 100644 index 0000000..791d97c --- a/dev/null +++ b/pics/sysinfo/pattern.png | |||
Binary files differ | |||