-rw-r--r-- | noncore/settings/sysinfo/benchmarkinfo.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index d6ecec5..2c68fd5 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp | |||
@@ -1,141 +1,145 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** BenchmarkInfo | 2 | ** BenchmarkInfo |
3 | ** | 3 | ** |
4 | ** A benchmark for Qt/Embedded | 4 | ** A benchmark 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 | /* OPIE */ | 19 | /* OPIE */ |
20 | #include <opie2/ostorageinfo.h> | 20 | #include <opie2/ostorageinfo.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpedecoration_qws.h> | 23 | #include <qpe/qpedecoration_qws.h> |
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | 26 | ||
27 | /* QT */ | 27 | /* QT */ |
28 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
29 | #include <qcolor.h> | 29 | #include <qcolor.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qdirectpainter_qws.h> | 31 | #include <qdirectpainter_qws.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qfiledialog.h> | 34 | #include <qfiledialog.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | 40 | ||
41 | /* STD */ | 41 | /* STD */ |
42 | #include <time.h> | 42 | #include <time.h> |
43 | #include <stdio.h> | 43 | #include <stdio.h> |
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <math.h> | 45 | #include <math.h> |
46 | #if defined (__GNUC__) && (__GNUC__ < 3) | ||
47 | extern double round(double); | ||
48 | #endif | ||
49 | |||
46 | 50 | ||
47 | #include "benchmarkinfo.h" | 51 | #include "benchmarkinfo.h" |
48 | 52 | ||
49 | extern "C" | 53 | extern "C" |
50 | { | 54 | { |
51 | void BenchFFT( void ); | 55 | void BenchFFT( void ); |
52 | double dhry_main( int ); | 56 | double dhry_main( int ); |
53 | } | 57 | } |
54 | 58 | ||
55 | #define DHRYSTONE_RUNS 20000000 | 59 | #define DHRYSTONE_RUNS 20000000 |
56 | #define TEST_DURATION 3 | 60 | #define TEST_DURATION 3 |
57 | 61 | ||
58 | #define BUFF_SIZE 8192 | 62 | #define BUFF_SIZE 8192 |
59 | #define FILE_SIZE 1024 * 1024 // 1Mb | 63 | #define FILE_SIZE 1024 * 1024 // 1Mb |
60 | 64 | ||
61 | //=========================================================================== | 65 | //=========================================================================== |
62 | 66 | ||
63 | class BenchmarkPaintWidget : public QWidget | 67 | class BenchmarkPaintWidget : public QWidget |
64 | { | 68 | { |
65 | public: | 69 | public: |
66 | BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) | 70 | BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) |
67 | { | 71 | { |
68 | resize( QApplication::desktop()->size() ); | 72 | resize( QApplication::desktop()->size() ); |
69 | show(); | 73 | show(); |
70 | p.begin( this ); | 74 | p.begin( this ); |
71 | }; | 75 | }; |
72 | 76 | ||
73 | ~BenchmarkPaintWidget() | 77 | ~BenchmarkPaintWidget() |
74 | { | 78 | { |
75 | p.end(); | 79 | p.end(); |
76 | hide(); | 80 | hide(); |
77 | }; | 81 | }; |
78 | 82 | ||
79 | QPainter p; | 83 | QPainter p; |
80 | }; | 84 | }; |
81 | 85 | ||
82 | //=========================================================================== | 86 | //=========================================================================== |
83 | 87 | ||
84 | BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) | 88 | BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) |
85 | : QWidget( parent, name, wFlags ) | 89 | : QWidget( parent, name, wFlags ) |
86 | { | 90 | { |
87 | 91 | ||
88 | setMinimumSize( 200, 150 ); | 92 | setMinimumSize( 200, 150 ); |
89 | 93 | ||
90 | QVBoxLayout* vb = new QVBoxLayout( this ); | 94 | QVBoxLayout* vb = new QVBoxLayout( this ); |
91 | vb->setSpacing( 4 ); | 95 | vb->setSpacing( 4 ); |
92 | vb->setMargin( 4 ); | 96 | vb->setMargin( 4 ); |
93 | 97 | ||
94 | tests = new QListView( this ); | 98 | tests = new QListView( this ); |
95 | tests->setMargin( 0 ); | 99 | tests->setMargin( 0 ); |
96 | tests->addColumn( tr( "Tests" ) ); | 100 | tests->addColumn( tr( "Tests" ) ); |
97 | tests->addColumn( tr( "Results" ) ); | 101 | tests->addColumn( tr( "Results" ) ); |
98 | tests->addColumn( tr( "Comparison" ) ); | 102 | tests->addColumn( tr( "Comparison" ) ); |
99 | tests->setShowSortIndicator( true ); | 103 | tests->setShowSortIndicator( true ); |
100 | 104 | ||
101 | test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox ); | 105 | test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox ); |
102 | test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox ); | 106 | test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox ); |
103 | test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox ); | 107 | test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox ); |
104 | test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox ); | 108 | test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox ); |
105 | test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox ); | 109 | test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox ); |
106 | test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox ); | 110 | test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox ); |
107 | test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox ); | 111 | test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox ); |
108 | 112 | ||
109 | test_alu->setText( 1, "n/a" ); | 113 | test_alu->setText( 1, "n/a" ); |
110 | test_fpu->setText( 1, "n/a" ); | 114 | test_fpu->setText( 1, "n/a" ); |
111 | test_txt->setText( 1, "n/a" ); | 115 | test_txt->setText( 1, "n/a" ); |
112 | test_gfx->setText( 1, "n/a" ); | 116 | test_gfx->setText( 1, "n/a" ); |
113 | test_ram->setText( 1, "n/a" ); | 117 | test_ram->setText( 1, "n/a" ); |
114 | test_sd->setText( 1, "n/a" ); | 118 | test_sd->setText( 1, "n/a" ); |
115 | test_cf->setText( 1, "n/a" ); | 119 | test_cf->setText( 1, "n/a" ); |
116 | 120 | ||
117 | test_alu->setText( 2, "n/a" ); | 121 | test_alu->setText( 2, "n/a" ); |
118 | test_fpu->setText( 2, "n/a" ); | 122 | test_fpu->setText( 2, "n/a" ); |
119 | test_txt->setText( 2, "n/a" ); | 123 | test_txt->setText( 2, "n/a" ); |
120 | test_gfx->setText( 2, "n/a" ); | 124 | test_gfx->setText( 2, "n/a" ); |
121 | test_ram->setText( 2, "n/a" ); | 125 | test_ram->setText( 2, "n/a" ); |
122 | test_sd->setText( 2, "n/a" ); | 126 | test_sd->setText( 2, "n/a" ); |
123 | test_cf->setText( 2, "n/a" ); | 127 | test_cf->setText( 2, "n/a" ); |
124 | 128 | ||
125 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); | 129 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); |
126 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); | 130 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); |
127 | 131 | ||
128 | vb->addWidget( tests, 2 ); | 132 | vb->addWidget( tests, 2 ); |
129 | 133 | ||
130 | QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); | 134 | QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); |
131 | if ( f.open( IO_ReadOnly ) ) | 135 | if ( f.open( IO_ReadOnly ) ) |
132 | { | 136 | { |
133 | machineCombo = new QComboBox( this ); | 137 | machineCombo = new QComboBox( this ); |
134 | 138 | ||
135 | QTextStream ts( &f ); | 139 | QTextStream ts( &f ); |
136 | while( !ts.eof() ) | 140 | while( !ts.eof() ) |
137 | { | 141 | { |
138 | QString machline = ts.readLine(); | 142 | QString machline = ts.readLine(); |
139 | qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); | 143 | qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); |
140 | QString resline = ts.readLine(); | 144 | QString resline = ts.readLine(); |
141 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); | 145 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); |