author | mickeyl <mickeyl> | 2004-11-04 14:13:05 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-11-04 14:13:05 (UTC) |
commit | 18684ddb43d4d79304dee6b20ab62513ee50b883 (patch) (unidiff) | |
tree | 20c765170a62da7e10eb57a47dd5f68db41b7cc2 | |
parent | 34abbfc57a28dc2d08f71e8e29562659aa3942ac (diff) | |
download | opie-18684ddb43d4d79304dee6b20ab62513ee50b883.zip opie-18684ddb43d4d79304dee6b20ab62513ee50b883.tar.gz opie-18684ddb43d4d79304dee6b20ab62513ee50b883.tar.bz2 |
tiny layout tweak
-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.cpp | 2 | ||||
-rw-r--r-- | share/sysinfo/results | 2 |
2 files changed, 1 insertions, 3 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 060185a..2a269b8 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp | |||
@@ -1,408 +1,406 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** BenchmarkInfo | 2 | ** BenchmarkInfo |
3 | ** | 3 | ** |
4 | ** A benchmark widget for Qt/Embedded | 4 | ** A benchmark widget for Qt/Embedded |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2004 Michael Lauer <mickey@vanille.de> | 6 | ** Copyright (C) 2004 Michael Lauer <mickey@vanille.de> |
7 | ** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp> | 7 | ** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp> |
8 | ** | 8 | ** |
9 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 11 | ** Foundation and appearing in the file LICENSE.GPL included in the |
12 | ** packaging of this file. | 12 | ** packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
16 | ** | 16 | ** |
17 | **********************************************************************/ | 17 | **********************************************************************/ |
18 | 18 | ||
19 | #include "benchmarkinfo.h" | 19 | #include "benchmarkinfo.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <opie2/ostorageinfo.h> | 23 | #include <opie2/ostorageinfo.h> |
24 | #include <opie2/olistview.h> | 24 | #include <opie2/olistview.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/qpedecoration_qws.h> | 27 | #include <qpe/qpedecoration_qws.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
31 | using namespace Opie::Ui; | 31 | using namespace Opie::Ui; |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qclipboard.h> | 34 | #include <qclipboard.h> |
35 | #include <qcolor.h> | 35 | #include <qcolor.h> |
36 | #include <qcombobox.h> | 36 | #include <qcombobox.h> |
37 | #include <qdirectpainter_qws.h> | 37 | #include <qdirectpainter_qws.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
40 | #include <qfiledialog.h> | 40 | #include <qfiledialog.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qpainter.h> | 43 | #include <qpainter.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qtimer.h> | 45 | #include <qtimer.h> |
46 | #include <qwhatsthis.h> | 46 | #include <qwhatsthis.h> |
47 | 47 | ||
48 | /* STD */ | 48 | /* STD */ |
49 | #include <time.h> | 49 | #include <time.h> |
50 | #include <stdio.h> | 50 | #include <stdio.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <math.h> | 52 | #include <math.h> |
53 | #if defined (__GNUC__) && (__GNUC__ < 3) | 53 | #if defined (__GNUC__) && (__GNUC__ < 3) |
54 | #define round qRound | 54 | #define round qRound |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | extern "C" | 57 | extern "C" |
58 | { | 58 | { |
59 | void BenchFFT( void ); | 59 | void BenchFFT( void ); |
60 | double dhry_main( int ); | 60 | double dhry_main( int ); |
61 | } | 61 | } |
62 | 62 | ||
63 | #define DHRYSTONE_RUNS 20000000 | 63 | #define DHRYSTONE_RUNS 20000000 |
64 | #define TEST_DURATION 3 | 64 | #define TEST_DURATION 3 |
65 | 65 | ||
66 | //=========================================================================== | 66 | //=========================================================================== |
67 | 67 | ||
68 | class BenchmarkPaintWidget : public QWidget | 68 | class BenchmarkPaintWidget : public QWidget |
69 | { | 69 | { |
70 | public: | 70 | public: |
71 | BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) | 71 | BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) |
72 | { | 72 | { |
73 | resize( QApplication::desktop()->size() ); | 73 | resize( QApplication::desktop()->size() ); |
74 | show(); | 74 | show(); |
75 | p.begin( this ); | 75 | p.begin( this ); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | ~BenchmarkPaintWidget() | 78 | ~BenchmarkPaintWidget() |
79 | { | 79 | { |
80 | p.end(); | 80 | p.end(); |
81 | hide(); | 81 | hide(); |
82 | }; | 82 | }; |
83 | 83 | ||
84 | QPainter p; | 84 | QPainter p; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | //=========================================================================== | 87 | //=========================================================================== |
88 | 88 | ||
89 | BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) | 89 | BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) |
90 | : QWidget( parent, name, wFlags ) | 90 | : QWidget( parent, name, wFlags ) |
91 | { | 91 | { |
92 | 92 | ||
93 | setMinimumSize( 200, 150 ); | 93 | setMinimumSize( 200, 150 ); |
94 | 94 | ||
95 | QVBoxLayout* vb = new QVBoxLayout( this ); | 95 | QVBoxLayout* vb = new QVBoxLayout( this ); |
96 | vb->setSpacing( 4 ); | 96 | vb->setSpacing( 4 ); |
97 | vb->setMargin( 4 ); | 97 | vb->setMargin( 4 ); |
98 | 98 | ||
99 | tests = new OListView( this ); | 99 | tests = new OListView( this ); |
100 | QWhatsThis::add( tests->viewport(), tr( "This area shows the available tests, the results for which the tests " | 100 | QWhatsThis::add( tests->viewport(), tr( "This area shows the available tests, the results for which the tests " |
101 | "have been performed, and comparison values for one selected device. " | 101 | "have been performed, and comparison values for one selected device. " |
102 | "Use the checkboxes to define which tests you want to perform." ) ); | 102 | "Use the checkboxes to define which tests you want to perform." ) ); |
103 | tests->setMargin( 0 ); | 103 | tests->setMargin( 0 ); |
104 | tests->addColumn( tr( "Tests" ) ); | 104 | tests->addColumn( tr( "Tests" ) ); |
105 | tests->addColumn( tr( "Results" ) ); | 105 | tests->addColumn( tr( "Results" ) ); |
106 | tests->addColumn( tr( "Comparison" ) ); | 106 | tests->addColumn( tr( "Comparison" ) ); |
107 | tests->setShowSortIndicator( true ); | 107 | tests->setShowSortIndicator( true ); |
108 | 108 | ||
109 | test_alu = new OCheckListItem( tests, tr( "1. Integer Arithmetic " ), OCheckListItem::CheckBox ); | 109 | test_alu = new OCheckListItem( tests, tr( "1. Integer Arithmetic " ), OCheckListItem::CheckBox ); |
110 | test_fpu = new OCheckListItem( tests, tr( "2. Floating Point Unit " ), OCheckListItem::CheckBox ); | 110 | test_fpu = new OCheckListItem( tests, tr( "2. Floating Point Unit " ), OCheckListItem::CheckBox ); |
111 | test_txt = new OCheckListItem( tests, tr( "3. Text Rendering " ), OCheckListItem::CheckBox ); | 111 | test_txt = new OCheckListItem( tests, tr( "3. Text Rendering " ), OCheckListItem::CheckBox ); |
112 | test_gfx = new OCheckListItem( tests, tr( "4. Gfx Rendering " ), OCheckListItem::CheckBox ); | 112 | test_gfx = new OCheckListItem( tests, tr( "4. Gfx Rendering " ), OCheckListItem::CheckBox ); |
113 | test_ram = new OCheckListItem( tests, tr( "5. RAM Performance " ), OCheckListItem::CheckBox ); | 113 | test_ram = new OCheckListItem( tests, tr( "5. RAM Performance " ), OCheckListItem::CheckBox ); |
114 | #ifndef QT_QWS_RAMSES | 114 | #ifndef QT_QWS_RAMSES |
115 | test_sd = new OCheckListItem( tests, tr( "6. SD Card Performance " ), OCheckListItem::CheckBox ); | 115 | test_sd = new OCheckListItem( tests, tr( "6. SD Card Performance " ), OCheckListItem::CheckBox ); |
116 | test_cf = new OCheckListItem( tests, tr( "7. CF Card Performance " ), OCheckListItem::CheckBox ); | 116 | test_cf = new OCheckListItem( tests, tr( "7. CF Card Performance " ), OCheckListItem::CheckBox ); |
117 | #endif | 117 | #endif |
118 | test_alu->setText( 1, "n/a" ); | 118 | test_alu->setText( 1, "n/a" ); |
119 | test_fpu->setText( 1, "n/a" ); | 119 | test_fpu->setText( 1, "n/a" ); |
120 | test_txt->setText( 1, "n/a" ); | 120 | test_txt->setText( 1, "n/a" ); |
121 | test_gfx->setText( 1, "n/a" ); | 121 | test_gfx->setText( 1, "n/a" ); |
122 | test_ram->setText( 1, "n/a" ); | 122 | test_ram->setText( 1, "n/a" ); |
123 | #ifndef QT_QWS_RAMSES | 123 | #ifndef QT_QWS_RAMSES |
124 | test_sd->setText( 1, "n/a" ); | 124 | test_sd->setText( 1, "n/a" ); |
125 | test_cf->setText( 1, "n/a" ); | 125 | test_cf->setText( 1, "n/a" ); |
126 | #endif | 126 | #endif |
127 | test_alu->setText( 2, "n/a" ); | 127 | test_alu->setText( 2, "n/a" ); |
128 | test_fpu->setText( 2, "n/a" ); | 128 | test_fpu->setText( 2, "n/a" ); |
129 | test_txt->setText( 2, "n/a" ); | 129 | test_txt->setText( 2, "n/a" ); |
130 | test_gfx->setText( 2, "n/a" ); | 130 | test_gfx->setText( 2, "n/a" ); |
131 | test_ram->setText( 2, "n/a" ); | 131 | test_ram->setText( 2, "n/a" ); |
132 | #ifndef QT_QWS_RAMSES | 132 | #ifndef QT_QWS_RAMSES |
133 | test_sd->setText( 2, "n/a" ); | 133 | test_sd->setText( 2, "n/a" ); |
134 | test_cf->setText( 2, "n/a" ); | 134 | test_cf->setText( 2, "n/a" ); |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); | 137 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); |
138 | QWhatsThis::add( startButton, tr( "Click here to perform the selected tests." ) ); | 138 | QWhatsThis::add( startButton, tr( "Click here to perform the selected tests." ) ); |
139 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); | 139 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); |
140 | vb->addWidget( tests, 2 ); | 140 | vb->addWidget( tests, 2 ); |
141 | 141 | ||
142 | QHBoxLayout* hb = new QHBoxLayout( vb ); | 142 | QHBoxLayout* hb = new QHBoxLayout( vb ); |
143 | hb->addWidget( startButton, 2 ); | 143 | hb->addWidget( startButton, 2 ); |
144 | 144 | ||
145 | QFile f( QPEApplication::qpeDir() + "share/sysinfo/results" ); | 145 | QFile f( QPEApplication::qpeDir() + "share/sysinfo/results" ); |
146 | if ( f.open( IO_ReadOnly ) ) | 146 | if ( f.open( IO_ReadOnly ) ) |
147 | { | 147 | { |
148 | machineCombo = new QComboBox( this ); | 148 | machineCombo = new QComboBox( this ); |
149 | QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); | 149 | QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); |
150 | 150 | ||
151 | QTextStream ts( &f ); | 151 | QTextStream ts( &f ); |
152 | while( !ts.eof() ) | 152 | while( !ts.eof() ) |
153 | { | 153 | { |
154 | QString machline = ts.readLine(); | 154 | QString machline = ts.readLine(); |
155 | odebug << "sysinfo: parsing benchmark results for '" << machline << "'" << oendl; | 155 | odebug << "sysinfo: parsing benchmark results for '" << machline << "'" << oendl; |
156 | QString resline = ts.readLine(); | 156 | QString resline = ts.readLine(); |
157 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); | 157 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); |
158 | machineCombo->insertItem( machline ); | 158 | machineCombo->insertItem( machline ); |
159 | } | 159 | } |
160 | |||
161 | hb->addWidget( new QLabel( tr( "Compare:" ), this ) ); | ||
162 | hb->addWidget( machineCombo, 2 ); | 160 | hb->addWidget( machineCombo, 2 ); |
163 | connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); | 161 | connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); |
164 | } | 162 | } |
165 | } | 163 | } |
166 | 164 | ||
167 | 165 | ||
168 | BenchmarkInfo::~BenchmarkInfo() | 166 | BenchmarkInfo::~BenchmarkInfo() |
169 | {} | 167 | {} |
170 | 168 | ||
171 | 169 | ||
172 | void BenchmarkInfo::machineActivated( int index ) | 170 | void BenchmarkInfo::machineActivated( int index ) |
173 | { | 171 | { |
174 | QStringList* results = machines[ machineCombo->text( index ) ]; | 172 | QStringList* results = machines[ machineCombo->text( index ) ]; |
175 | if ( !results ) | 173 | if ( !results ) |
176 | { | 174 | { |
177 | odebug << "sysinfo: no results available." << oendl; | 175 | odebug << "sysinfo: no results available." << oendl; |
178 | return; | 176 | return; |
179 | } | 177 | } |
180 | QStringList::Iterator it = results->begin(); | 178 | QStringList::Iterator it = results->begin(); |
181 | test_alu->setText( 2, *(it++) ); | 179 | test_alu->setText( 2, *(it++) ); |
182 | test_fpu->setText( 2, *(it++) ); | 180 | test_fpu->setText( 2, *(it++) ); |
183 | test_txt->setText( 2, *(it++) ); | 181 | test_txt->setText( 2, *(it++) ); |
184 | test_gfx->setText( 2, *(it++) ); | 182 | test_gfx->setText( 2, *(it++) ); |
185 | test_ram->setText( 2, *(it++) ); | 183 | test_ram->setText( 2, *(it++) ); |
186 | #ifndef QT_QWS_RAMSES | 184 | #ifndef QT_QWS_RAMSES |
187 | test_sd->setText( 2, *(it++) ); | 185 | test_sd->setText( 2, *(it++) ); |
188 | test_cf->setText( 2, *(it++) ); | 186 | test_cf->setText( 2, *(it++) ); |
189 | #endif | 187 | #endif |
190 | } | 188 | } |
191 | 189 | ||
192 | 190 | ||
193 | void BenchmarkInfo::run() | 191 | void BenchmarkInfo::run() |
194 | { | 192 | { |
195 | startButton->setText( "> Don't touch! <" ); | 193 | startButton->setText( "> Don't touch! <" ); |
196 | qApp->processEvents(); | 194 | qApp->processEvents(); |
197 | QTime t; | 195 | QTime t; |
198 | 196 | ||
199 | if ( test_alu->isOn() ) | 197 | if ( test_alu->isOn() ) |
200 | { | 198 | { |
201 | int d = round( dhry_main( DHRYSTONE_RUNS ) ); | 199 | int d = round( dhry_main( DHRYSTONE_RUNS ) ); |
202 | test_alu->setText( 1, QString().sprintf( "%d dhrys", d ) ); | 200 | test_alu->setText( 1, QString().sprintf( "%d dhrys", d ) ); |
203 | test_alu->setOn( false ); | 201 | test_alu->setOn( false ); |
204 | } | 202 | } |
205 | 203 | ||
206 | if ( test_fpu->isOn() ) | 204 | if ( test_fpu->isOn() ) |
207 | { | 205 | { |
208 | t.start(); | 206 | t.start(); |
209 | BenchFFT(); | 207 | BenchFFT(); |
210 | test_fpu->setText( 1, QString().sprintf( "%.2f secs", t.elapsed() / 1000.0 ) );; | 208 | test_fpu->setText( 1, QString().sprintf( "%.2f secs", t.elapsed() / 1000.0 ) );; |
211 | test_fpu->setOn( false ); | 209 | test_fpu->setOn( false ); |
212 | } | 210 | } |
213 | 211 | ||
214 | if ( test_txt->isOn() ) | 212 | if ( test_txt->isOn() ) |
215 | { | 213 | { |
216 | int value = textRendering( TEST_DURATION ); | 214 | int value = textRendering( TEST_DURATION ); |
217 | test_txt->setText( 1, QString().sprintf( "%d chars/sec", value / TEST_DURATION ) ); | 215 | test_txt->setText( 1, QString().sprintf( "%d chars/sec", value / TEST_DURATION ) ); |
218 | test_txt->setOn( false ); | 216 | test_txt->setOn( false ); |
219 | } | 217 | } |
220 | 218 | ||
221 | if ( test_gfx->isOn() ) | 219 | if ( test_gfx->isOn() ) |
222 | { | 220 | { |
223 | int value = gfxRendering( TEST_DURATION ); | 221 | int value = gfxRendering( TEST_DURATION ); |
224 | test_gfx->setText( 1, QString().sprintf( "%.2f gops/sec", value / 4.0 / TEST_DURATION ) ); // 4 tests | 222 | test_gfx->setText( 1, QString().sprintf( "%.2f gops/sec", value / 4.0 / TEST_DURATION ) ); // 4 tests |
225 | test_gfx->setOn( false ); | 223 | test_gfx->setOn( false ); |
226 | } | 224 | } |
227 | 225 | ||
228 | if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA | 226 | if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA |
229 | { | 227 | { |
230 | performFileTest( "/tmp/benchmarkFile.dat", test_ram ); | 228 | performFileTest( "/tmp/benchmarkFile.dat", test_ram ); |
231 | } | 229 | } |
232 | 230 | ||
233 | #ifndef QT_QWS_RAMSES | 231 | #ifndef QT_QWS_RAMSES |
234 | if ( test_cf->isOn() ) | 232 | if ( test_cf->isOn() ) |
235 | { | 233 | { |
236 | OStorageInfo storage; | 234 | OStorageInfo storage; |
237 | performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf ); | 235 | performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf ); |
238 | } | 236 | } |
239 | 237 | ||
240 | if ( test_sd->isOn() ) | 238 | if ( test_sd->isOn() ) |
241 | { | 239 | { |
242 | OStorageInfo storage; | 240 | OStorageInfo storage; |
243 | performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd ); | 241 | performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd ); |
244 | } | 242 | } |
245 | #endif | 243 | #endif |
246 | 244 | ||
247 | startButton->setText( tr( "&Start Tests!" ) ); | 245 | startButton->setText( tr( "&Start Tests!" ) ); |
248 | } | 246 | } |
249 | 247 | ||
250 | 248 | ||
251 | int BenchmarkInfo::textRendering( int seconds ) | 249 | int BenchmarkInfo::textRendering( int seconds ) |
252 | { | 250 | { |
253 | QTime t; | 251 | QTime t; |
254 | t.start(); | 252 | t.start(); |
255 | int stop = t.elapsed() + seconds * 1000; | 253 | int stop = t.elapsed() + seconds * 1000; |
256 | 254 | ||
257 | int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; | 255 | int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; |
258 | int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; | 256 | int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; |
259 | int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; | 257 | int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; |
260 | const QString text( "Opie Benchmark Test" ); | 258 | const QString text( "Opie Benchmark Test" ); |
261 | 259 | ||
262 | int w = QApplication::desktop()->width(); | 260 | int w = QApplication::desktop()->width(); |
263 | int h = QApplication::desktop()->height(); | 261 | int h = QApplication::desktop()->height(); |
264 | 262 | ||
265 | srand( time( NULL ) ); | 263 | srand( time( NULL ) ); |
266 | 264 | ||
267 | BenchmarkPaintWidget bpw; | 265 | BenchmarkPaintWidget bpw; |
268 | 266 | ||
269 | int loops = 0; | 267 | int loops = 0; |
270 | 268 | ||
271 | while ( t.elapsed() < stop ) | 269 | while ( t.elapsed() < stop ) |
272 | { | 270 | { |
273 | int k = rand() % 9; | 271 | int k = rand() % 9; |
274 | int s = rand() % 100; | 272 | int s = rand() % 100; |
275 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | 273 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); |
276 | bpw.p.setFont( QFont( "Vera", s ) ); | 274 | bpw.p.setFont( QFont( "Vera", s ) ); |
277 | bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); | 275 | bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); |
278 | ++loops; | 276 | ++loops; |
279 | } | 277 | } |
280 | 278 | ||
281 | return loops * text.length(); | 279 | return loops * text.length(); |
282 | } | 280 | } |
283 | 281 | ||
284 | int BenchmarkInfo::gfxRendering( int seconds ) | 282 | int BenchmarkInfo::gfxRendering( int seconds ) |
285 | { | 283 | { |
286 | int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; | 284 | int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; |
287 | int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; | 285 | int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; |
288 | int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; | 286 | int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; |
289 | 287 | ||
290 | int w = QApplication::desktop()->width(); | 288 | int w = QApplication::desktop()->width(); |
291 | int h = QApplication::desktop()->height(); | 289 | int h = QApplication::desktop()->height(); |
292 | 290 | ||
293 | srand( time( NULL ) ); | 291 | srand( time( NULL ) ); |
294 | 292 | ||
295 | BenchmarkPaintWidget bpw; | 293 | BenchmarkPaintWidget bpw; |
296 | 294 | ||
297 | QTime t; | 295 | QTime t; |
298 | t.start(); | 296 | t.start(); |
299 | int stop = t.elapsed() + seconds*1000; | 297 | int stop = t.elapsed() + seconds*1000; |
300 | int loops = 0; | 298 | int loops = 0; |
301 | 299 | ||
302 | while ( t.elapsed() < stop ) | 300 | while ( t.elapsed() < stop ) |
303 | { | 301 | { |
304 | int k = rand() % 9; | 302 | int k = rand() % 9; |
305 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | 303 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); |
306 | bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); | 304 | bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); |
307 | ++loops; | 305 | ++loops; |
308 | } | 306 | } |
309 | 307 | ||
310 | t.restart(); | 308 | t.restart(); |
311 | stop = t.elapsed() + seconds*1000; | 309 | stop = t.elapsed() + seconds*1000; |
312 | 310 | ||
313 | while ( t.elapsed() < stop ) | 311 | while ( t.elapsed() < stop ) |
314 | { | 312 | { |
315 | int k = rand() % 9; | 313 | int k = rand() % 9; |
316 | bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | 314 | 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 ); | 315 | bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); |
318 | ++loops; | 316 | ++loops; |
319 | } | 317 | } |
320 | 318 | ||
321 | QBrush br1; | 319 | QBrush br1; |
322 | br1.setStyle( SolidPattern ); | 320 | br1.setStyle( SolidPattern ); |
323 | t.restart(); | 321 | t.restart(); |
324 | stop = t.elapsed() + seconds*1000; | 322 | stop = t.elapsed() + seconds*1000; |
325 | 323 | ||
326 | while ( t.elapsed() < stop ) | 324 | while ( t.elapsed() < stop ) |
327 | { | 325 | { |
328 | int k = rand() % 9; | 326 | int k = rand() % 9; |
329 | br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); | 327 | br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); |
330 | bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); | 328 | bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); |
331 | ++loops; | 329 | ++loops; |
332 | } | 330 | } |
333 | 331 | ||
334 | QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); | 332 | QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); |
335 | t.restart(); | 333 | t.restart(); |
336 | stop = t.elapsed() + seconds*1000; | 334 | stop = t.elapsed() + seconds*1000; |
337 | 335 | ||
338 | while ( t.elapsed() < stop ) | 336 | while ( t.elapsed() < stop ) |
339 | { | 337 | { |
340 | bpw.p.drawPixmap( rand()%w, rand()%h, p ); | 338 | bpw.p.drawPixmap( rand()%w, rand()%h, p ); |
341 | ++loops; | 339 | ++loops; |
342 | } | 340 | } |
343 | 341 | ||
344 | return loops; | 342 | return loops; |
345 | 343 | ||
346 | } | 344 | } |
347 | 345 | ||
348 | const unsigned int FILE_TEST_COUNT = 8000; | 346 | const unsigned int FILE_TEST_COUNT = 8000; |
349 | const unsigned int FILE_TEST_BLOCKSIZE = 1024; | 347 | const unsigned int FILE_TEST_BLOCKSIZE = 1024; |
350 | 348 | ||
351 | void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item ) | 349 | void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item ) |
352 | { | 350 | { |
353 | QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname; | 351 | QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname; |
354 | odebug << "performing file test on " << filename << oendl; | 352 | odebug << "performing file test on " << filename << oendl; |
355 | 353 | ||
356 | QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename ) | 354 | QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename ) |
357 | .arg( FILE_TEST_COUNT ) | 355 | .arg( FILE_TEST_COUNT ) |
358 | .arg( FILE_TEST_BLOCKSIZE ); | 356 | .arg( FILE_TEST_BLOCKSIZE ); |
359 | QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename ) | 357 | QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename ) |
360 | .arg( FILE_TEST_COUNT ) | 358 | .arg( FILE_TEST_COUNT ) |
361 | .arg( FILE_TEST_BLOCKSIZE ); | 359 | .arg( FILE_TEST_BLOCKSIZE ); |
362 | ::system( "sync" ); | 360 | ::system( "sync" ); |
363 | odebug << "performing file test on " << filename << oendl; | 361 | odebug << "performing file test on " << filename << oendl; |
364 | 362 | ||
365 | int write = 0; | 363 | int write = 0; |
366 | int read = 0; | 364 | int read = 0; |
367 | 365 | ||
368 | QTime time; | 366 | QTime time; |
369 | time.start(); | 367 | time.start(); |
370 | if ( ::system( writeCommand ) == 0 ) | 368 | if ( ::system( writeCommand ) == 0 ) |
371 | { | 369 | { |
372 | write = time.elapsed(); | 370 | write = time.elapsed(); |
373 | } | 371 | } |
374 | else | 372 | else |
375 | { | 373 | { |
376 | item->setText( 1, tr( "error" ) ); | 374 | item->setText( 1, tr( "error" ) ); |
377 | return; | 375 | return; |
378 | } | 376 | } |
379 | 377 | ||
380 | time.restart(); | 378 | time.restart(); |
381 | if ( ::system( readCommand ) == 0 ) | 379 | if ( ::system( readCommand ) == 0 ) |
382 | { | 380 | { |
383 | read = time.elapsed(); | 381 | read = time.elapsed(); |
384 | } | 382 | } |
385 | else | 383 | else |
386 | { | 384 | { |
387 | item->setText( 1, tr( "error" ) ); | 385 | item->setText( 1, tr( "error" ) ); |
388 | return; | 386 | return; |
389 | } | 387 | } |
390 | 388 | ||
391 | QFile::remove( filename ); | 389 | QFile::remove( filename ); |
392 | double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 ); | 390 | double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 ); |
393 | QString readUnit = "kB/s"; | 391 | QString readUnit = "kB/s"; |
394 | if ( readSpeed > 1024 ) | 392 | if ( readSpeed > 1024 ) |
395 | { | 393 | { |
396 | readSpeed /= 1024.0; | 394 | readSpeed /= 1024.0; |
397 | readUnit = "MB/s"; | 395 | readUnit = "MB/s"; |
398 | } | 396 | } |
399 | double writeSpeed = FILE_TEST_COUNT / ( write / 1000.0 ); | 397 | double writeSpeed = FILE_TEST_COUNT / ( write / 1000.0 ); |
400 | QString writeUnit = "kb/s"; | 398 | QString writeUnit = "kb/s"; |
401 | if ( writeSpeed > 1024 ) | 399 | if ( writeSpeed > 1024 ) |
402 | { | 400 | { |
403 | writeSpeed /= 1024.0; | 401 | writeSpeed /= 1024.0; |
404 | writeUnit = "MB/s"; | 402 | writeUnit = "MB/s"; |
405 | } | 403 | } |
406 | item->setText( 1, QString().sprintf( "%.2f %s; %.2f %s", readSpeed, readUnit.latin1(), writeSpeed, writeUnit.latin1() ) ); | 404 | item->setText( 1, QString().sprintf( "%.2f %s; %.2f %s", readSpeed, readUnit.latin1(), writeSpeed, writeUnit.latin1() ) ); |
407 | item->setOn( false ); | 405 | item->setOn( false ); |
408 | } | 406 | } |
diff --git a/share/sysinfo/results b/share/sysinfo/results index d1fc6a8..7b7a587 100644 --- a/share/sysinfo/results +++ b/share/sysinfo/results | |||
@@ -1,32 +1,32 @@ | |||
1 | <Choose model> | 1 | <Compare to> |
2 | n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a | 2 | n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a |
3 | Sharp SL-5500 | 3 | Sharp SL-5500 |
4 | 240010 dhrys,41.498 sec,88 char/sec,1786 gops/sec,50.123 kb/sec,41.7329 kb/sec,105.873 kb/sec | 4 | 240010 dhrys,41.498 sec,88 char/sec,1786 gops/sec,50.123 kb/sec,41.7329 kb/sec,105.873 kb/sec |
5 | Sharp SL-5600 | 5 | Sharp SL-5600 |
6 | not,yet,contributed,please,mail,to,opie@handhelds.org | 6 | not,yet,contributed,please,mail,to,opie@handhelds.org |
7 | Sharp C-700 | 7 | Sharp C-700 |
8 | not,yet,contributed,please,mail,to,opie@handhelds.org | 8 | not,yet,contributed,please,mail,to,opie@handhelds.org |
9 | Sharp C-750 | 9 | Sharp C-750 |
10 | 490677 dhrys,2.452 sec,437 char/sec,1396 gops/sec,132.061 kb/sec,129.752 kb/sec,n/a | 10 | 490677 dhrys,2.452 sec,437 char/sec,1396 gops/sec,132.061 kb/sec,129.752 kb/sec,n/a |
11 | Sharp C-760 | 11 | Sharp C-760 |
12 | not,yet,contributed,please,mail,to,opie@handhelds.org | 12 | not,yet,contributed,please,mail,to,opie@handhelds.org |
13 | Sharp C-860 | 13 | Sharp C-860 |
14 | not,yet,contributed,please,mail,to,opie@handhelds.org | 14 | not,yet,contributed,please,mail,to,opie@handhelds.org |
15 | HP iPAQ 36xx | 15 | HP iPAQ 36xx |
16 | not,yet,contributed,please,mail,to,opie@handhelds.org | 16 | not,yet,contributed,please,mail,to,opie@handhelds.org |
17 | HP iPAQ 37xx | 17 | HP iPAQ 37xx |
18 | not,yet,contributed,please,mail,to,opie@handhelds.org | 18 | not,yet,contributed,please,mail,to,opie@handhelds.org |
19 | HP iPAQ 38xx | 19 | HP iPAQ 38xx |
20 | 234880 dhrys,42.37 sec,418 char/sec,1788 gops/sec,51.6911 kb/sec,31.1029 kb/sec,untested | 20 | 234880 dhrys,42.37 sec,418 char/sec,1788 gops/sec,51.6911 kb/sec,31.1029 kb/sec,untested |
21 | HP iPAQ 54xx | 21 | HP iPAQ 54xx |
22 | not,yet,contributed,please,mail,to,opie@handhelds.org | 22 | not,yet,contributed,please,mail,to,opie@handhelds.org |
23 | HP iPAQ 55xx | 23 | HP iPAQ 55xx |
24 | not,yet,contributed,please,mail,to,opie@handhelds.org | 24 | not,yet,contributed,please,mail,to,opie@handhelds.org |
25 | HP Jornada 5x0 | 25 | HP Jornada 5x0 |
26 | not,yet,contributed,please,mail,to,opie@handhelds.org | 26 | not,yet,contributed,please,mail,to,opie@handhelds.org |
27 | M&N MNCI | 27 | M&N MNCI |
28 | 323677 dhrys,23.65 secs,183 char/sec,2142 gops/sec,50.40 MB/sec;19.24 MB/sec,n/a,n/a | 28 | 323677 dhrys,23.65 secs,183 char/sec,2142 gops/sec,50.40 MB/sec;19.24 MB/sec,n/a,n/a |
29 | SIEMENS SIMpad | 29 | SIEMENS SIMpad |
30 | not,yet,contributed,please,mail,to,opie@handhelds.org | 30 | not,yet,contributed,please,mail,to,opie@handhelds.org |
31 | MASTERIA Beagle | 31 | MASTERIA Beagle |
32 | not,yet,contributed,please,mail,to,opie@handhelds.org | 32 | not,yet,contributed,please,mail,to,opie@handhelds.org |