From 557424c8b345677038e6e35aae2ada22748af904 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Fri, 27 Feb 2004 16:26:54 +0000 Subject: 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! --- (limited to 'noncore') 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 @@ +/********************************************************************** +** BenchmarkInfo +** +** A benchmark for Qt/Embedded +** +** Copyright (C) 2004 Michael Lauer +** Inspired by ZBench (C) 2002 Satoshi +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +/* OPIE */ +#include +#include +#include +#include +#include + +/* QT */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* STD */ +#include +#include +#include + +#include "benchmarkinfo.h" + +extern "C" +{ + void BenchFFT( void ); +} + +//=========================================================================== + +class BenchmarkPaintWidget : public QWidget +{ + public: + BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) + { + resize( QApplication::desktop()->size() ); + show(); + p.begin( this ); + }; + + ~BenchmarkPaintWidget() + { + p.end(); + hide(); + }; + + QPainter p; +}; + +//=========================================================================== + +BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) + : QWidget( parent, name, wFlags ) +{ + + setMinimumSize( 200, 150 ); + + QVBoxLayout* vb = new QVBoxLayout( this ); + vb->setSpacing( 4 ); + vb->setMargin( 4 ); + + tests = new QListView( this ); + tests->setMargin( 1 ); + tests->addColumn( "Tests" ); + tests->addColumn( "Results" ); + tests->setShowSortIndicator( true ); + + test_alu = new QCheckListItem( tests, "1: Integer Arithmetic ", QCheckListItem::CheckBox ); + test_alu->setText( 1, "n/a" ); + test_fpu = new QCheckListItem( tests, "2: Floating Point Unit ", QCheckListItem::CheckBox ); + test_fpu->setText( 1, "n/a" ); + test_txt = new QCheckListItem( tests, "3: Text Rendering ", QCheckListItem::CheckBox ); + test_txt->setText( 1, "n/a" ); + test_gfx = new QCheckListItem( tests, "4: Gfx Rendering ", QCheckListItem::CheckBox ); + test_gfx->setText( 1, "n/a" ); + test_ram = new QCheckListItem( tests, "5: RAM Performance ", QCheckListItem::CheckBox ); + test_ram->setText( 1, "n/a" ); + test_sd = new QCheckListItem( tests, "6: SD Card Performance ", QCheckListItem::CheckBox ); + test_sd->setText( 1, "n/a" ); + test_cf = new QCheckListItem( tests, "7: CF Card Performance ", QCheckListItem::CheckBox ); + test_cf->setText( 1, "n/a" ); + + startButton = new QPushButton( tr( "&Start Tests!" ), this ); + connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); + + vb->addWidget( tests, 2 ); + vb->addWidget( startButton ); +} + + +BenchmarkInfo::~BenchmarkInfo() +{} + + +void BenchmarkInfo::run() +{ + startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); + qApp->processEvents(); + QTime t; + + if ( test_alu->isOn() ) + { + t.start(); + benchInteger(); + test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_alu->setOn( false ); + } + + if ( test_fpu->isOn() ) + { + t.start(); + BenchFFT(); + test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_fpu->setOn( false ); + } + + if ( test_txt->isOn() ) + { + t.start(); + paintChar(); + test_txt->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_txt->setOn( false ); + } + + if ( test_gfx->isOn() ) + { + t.start(); + paintLineRect(); + test_gfx->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_gfx->setOn( false ); + } + + if ( test_ram->isOn() ) + { + t.start(); + writeFile( "/tmp/benchmarkFile.dat" ); // /tmp is supposed to be in RAM on a PDA + readFile( "/tmp/benchmarkFile.dat" ); + QFile::remove( "/tmp/benchmarkFile.dat" ); + test_ram->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_ram->setOn( false ); + } +/* + if ( test_cf->isOn() ) + { + t.start(); + benchInteger(); + test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_alu->setOn( false ); + } + + if ( test_sd->isOn() ) + { + t.start(); + benchInteger(); + test_alu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); + test_alu->setOn( false ); + } + + if ( ( which_clipb ) && ( buf.length() > 0 ) ) + { + clb = QApplication::clipboard(); + clb->setText( dt_buf + buf ); + } + */ + + startButton->setText( tr( "&Start Tests!" ) ); +} + + +void BenchmarkInfo::benchInteger() const +{ + long dummy = 1; + + for ( long i= 0 ; i < INT_TEST_ITERATIONS ; i++ ) + { + for ( long j= 0 ; j < INT_TEST_ITERATIONS ; j++ ) + { + for( long k= 0 ; k < INT_TEST_ITERATIONS ; k++ ) + { + long xx = ( rand() % 1000 + 111 ) * 7 / 3 + 31; + long yy = ( rand() % 100 + 23 ) * 11 / 7 + 17; + long zz = ( rand() % 100 + 47 ) * 13 / 11 - 211; + dummy = xx * yy / zz; + dummy *= 23; + dummy += ( xx - yy + zz ); + dummy -= ( xx + yy - zz ); + dummy *= ( xx * zz * yy ); + dummy /= 1 + ( xx * yy * zz ); + } + } + } +} + + +void BenchmarkInfo::paintChar() +{ + int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; + int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; + int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; + const QString text( "Opie Benchmark Test" ); + + int w = QApplication::desktop()->width(); + int h = QApplication::desktop()->height(); + + srand( time( NULL ) ); + + BenchmarkPaintWidget bpw; + + for ( int i = 0; i < CHAR_TEST_ITERATIONS; ++i ) + { + int k = rand() % 9; + bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); + bpw.p.setFont( QFont( "Vera", k*10 ) ); + bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); + } +} + +void BenchmarkInfo::paintLineRect() +{ + int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; + int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; + int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; + + int w = QApplication::desktop()->width(); + int h = QApplication::desktop()->height(); + + srand( time( NULL ) ); + + BenchmarkPaintWidget bpw; + + for ( int i = 0; i < DRAW_TEST_ITERATIONS*3; ++i ) + { + int k = rand() % 9; + bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); + bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); + } + + for ( int i = 0; i < DRAW_TEST_ITERATIONS; ++i ) + { + int k = rand() % 9; + bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); + bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); + } + + QBrush br1; + br1.setStyle( SolidPattern ); + + for ( int i = 0; i < DRAW_TEST_ITERATIONS*2; ++i ) + { + int k = rand() % 9; + br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); + bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); + } + + QPixmap p = Resource::loadPixmap( "pattern" ); + for ( int i = 0; i < DRAW_TEST_ITERATIONS; ++i ) + { + bpw.p.drawPixmap( rand()%w, rand()%h, p ); + } + + +} + +// ********************************************************************** +// Read & Write +// v2.0.0 +// ********************************************************************** +#define BUFF_SIZE 8192 +#define FILE_SIZE 1024 * 1024 // 1Mb + +char FileBuf[ BUFF_SIZE + 1 ]; + +bool BenchmarkInfo::writeFile( const QString& w_path ) +{ + int i; + int k; + int n; + int pos; + int len; + char *data = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 62 + + + // /*------------------------------------ + int w_len; + + QFile writeFile( w_path ); + srand( time( NULL ) ); + + for ( n = 0 ; n < 20 ; n++ ) + { + if ( ! writeFile.open( IO_WriteOnly ) ) + { + writeFile.close(); + writeFile.remove(); + return ( false ); + } + // ------------------------------------------ sequential write + for ( k = 0 ; k < 256 ; k++ ) + { + n = rand() % 30; + memcpy( &FileBuf[ k * 32 ], &data[ n ], 32 ); + } + + for ( i = 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) + { + w_len = writeFile.writeBlock( FileBuf, BUFF_SIZE ); + if ( w_len != BUFF_SIZE ) + { + writeFile.close(); + writeFile.remove(); + return ( false ); + } + writeFile.flush(); + } + // ------------------------------------------ random write + for ( i = 0 ; i < 400 ; i++ ) + { + len = rand() % 90 + 4000; + for ( k = 0 ; k < 128 ; k++ ) + { + n = rand() % 30; + memcpy( &FileBuf[ k * 8 ], &data[ n ], 32 ); + } + pos = rand() % ( FILE_SIZE - BUFF_SIZE ); + + writeFile.at( pos ); + w_len = writeFile.writeBlock( FileBuf, len ); + if ( w_len != len ) + { + writeFile.close(); + writeFile.remove(); + return ( false ); + } + writeFile.flush(); + } + writeFile.close(); + } + return ( true ); + // ------------------------------------*/ + + /* ---------------------------------- + srand( time( NULL ) ); + + FILE *fp; + + for( n= 0 ; n < 40 ; n++ ) + { + if (( fp = fopen( w_path, "wt" )) == NULL ) + return( false ); + memset( FileBuf, '\0', BUFF_SIZE+1 ); + // ------------------------------------------ sequential write + for( i= 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) + { + for( k= 0 ; k < 128 ; k++ ) + { + n = rand() % 30; + memcpy( &FileBuf[k*8], &data[n], 32 ); + } + fputs( FileBuf, fp ); + } + // ------------------------------------------ random write + for( i= 0 ; i < 300 ; i++ ) + { + memset( FileBuf, '\0', 130 ); + len = rand() % 120 + 8; + for( k= 0 ; k < 16 ; k++ ) + { + n = rand() % 54; + memcpy( &FileBuf[k*8], &data[n], 8 ); + } + pos = rand() % ( FILE_SIZE / BUFF_SIZE - BUFF_SIZE ); + + fseek( fp, pos, SEEK_SET ); + fputs( FileBuf, fp ); + } + fclose( fp ); + } + return( true ); + -------------------------------------*/ +} + + +bool BenchmarkInfo::readFile( const QString& r_path ) +{ + int i; + int k; + int len; + int pos; + int r_len; + + QFile readFile( r_path ); + srand( time( NULL ) ); + + for ( k = 0 ; k < 200 ; k++ ) + { + if ( ! readFile.open( IO_ReadOnly ) ) + { + readFile.remove(); + return ( false ); + } + // ------------------------------------------ sequential read + readFile.at( 0 ); + for ( i = 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) + { + readFile.at( i * BUFF_SIZE ); + r_len = readFile.readBlock( FileBuf, BUFF_SIZE ); + if ( r_len != BUFF_SIZE ) + { + readFile.close(); + readFile.remove(); + return ( false ); + } + } + // ------------------------------------------ random read + for ( i = 0 ; i < 1000 ; i++ ) + { + len = rand() % 120 + 8; + pos = rand() % ( FILE_SIZE / BUFF_SIZE - BUFF_SIZE ); + readFile.at( pos ); + r_len = readFile.readBlock( FileBuf, len ); + if ( r_len != len ) + { + readFile.close(); + readFile.remove(); + return ( false ); + } + } + readFile.close(); + } + return ( true ); +} 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 @@ +/********************************************************************** +** BenchmarkInfo +** +** A benchmark for Qt/Embedded +** +** Copyright (C) 2004 Michael Lauer +** Inspired by ZBench (C) 2002 Satoshi +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include +#include + +class QClipboard; +class QCheckListItem; +class QPushButton; +class QListView; + +//#define INT_TEST_ITERATIONS 50 +//#define CHAR_TEST_ITERATIONS 15000 +//#define DRAW_TEST_ITERATIONS 5000 + +#define INT_TEST_ITERATIONS 50 +#define CHAR_TEST_ITERATIONS 15000 +#define DRAW_TEST_ITERATIONS 5000 + +class BenchmarkInfo : public QWidget +{ + Q_OBJECT + +public: + BenchmarkInfo( QWidget *parent = 0, const char *name = 0, int wFlags = 0 ); + ~BenchmarkInfo(); + + QCheckListItem* test_alu; + QCheckListItem* test_fpu; + QCheckListItem* test_txt; + QCheckListItem* test_gfx; + QCheckListItem* test_ram; + QCheckListItem* test_sd; + QCheckListItem* test_cf; + + bool main_rd; + bool main_wt; + bool sd_rd; + bool sd_wt; + bool cf_rd; + bool cf_wt; + + QClipboard* clb; + + QListView* tests; + QPushButton* startButton; + + void benchInteger() const; + void paintChar(); + void paintLineRect(); + bool writeFile( const QString& ); + bool readFile( const QString& ); + +private slots: + void run(); + +}; 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 @@ + +// ****************************************************************** +// Copyright (c) 2002- Satoshi, All Rights Reserved. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// +// Author : Satoshi ( af230533@im07.alpha-net.ne.jp ) +// ****************************************************************** + +//*********************************************************************** +// 高速フーリエ変換(FFT) +// 更にスピード・アップするにはCOSを固定で持つこと! +// +// Copyright (C) Satoshi 1994-2002 All rights reserved. +// *********************************************************************** + +#include + +#define FFT_TEST_COUNT 500 // Bench FFT + +// ----------------------------------------------------- FFT +#define OBJ_DATA_COUNT 128 +#define OBJ_DATA_SISU 7 // 128 = 2 ** 7 +#define OBJ_DATA_SLIDE 1 + +#define FFT_TRN 1 +#define IFFT_TRN -1 + +typedef struct _fft { + int N; // デジタル・データ件数 + int r; // N = 2^r + double* result_A; // サンプリングデータをここにセットする + // cos 成分…求めるスペクトル成分の数分の領域が必要 + double* result_B; // sin 成分…求めるスペクトル成分の数分の領域が必要 +} FFT; +#define FFT_SIZE sizeof( FFT ) + + +void digital_fft( FFT* fft ); + + +double SpectA[OBJ_DATA_COUNT]; +double SpectB[OBJ_DATA_COUNT]; + +double TestData[] = { + 0.998795456205172405, + 0.995184726672196929, + 0.146735474455360860, + 0.098217140329559660, + 0.980784545503230431, + 0.970031253194543974, + 0.956940335252408824, + -0.857728610000272118, + -0.831465612302545236, + -0.803205431480644943, + -0.774010453362736882, + -0.747954125354958995, + -0.707116781186547351, + -0.671125754847018219, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + 0.941544045483020806, + 0.923879532511286738, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + 0.707106781186547351, + -0.974034153194543974, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + -0.881112264348355050, + -0.857728610000272118, + 0.671558954847018219, + 0.049167674327417023, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + -0.980782180403230431, + -0.974034153194543974, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + 0.707106781186547351, + 0.671558954847018219, + 0.989576509964781014, + 0.980784545503230431, + 0.970031253194543974, + 0.654634123783645266, + 0.634646284163645266, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + -0.881112264348355050, + -0.857728610000272118, + -0.831465612302545236, + -0.803205431480644943, + -0.774010453362736882, + -0.747954125354958995, + -0.707116781186547351, + -0.671125754847018219, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + -0.514102744193221328, + -0.477396736825997198, + -0.477555093430281585, + -0.387688432365089171, + -0.335879853392219440, + -0.295878677254461665, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + -0.242980179903263122, + -0.195057822016127443, + -0.146775474455360860, + -0.098897540329559660, + -0.042866864327417023, + 0.998795456205172405, + 0.995184726672196929, + 0.989576509964781014, + 0.980784545503230431, + 0.970031253194543974, + 0.956940335252408824, + 0.941544045483020806, + 0.923879532511286738, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + -0.980782180403230431, + -0.974034153194543974, + 0.707106781186547351, + 0.671558954847018219, + 0.654634123783645266, + 0.634646284163645266, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + 0.336441853392219440, + 0.290284654254461665, + 0.242980479903263122, + 0.195094322016127443, + 0.146735474455360860, + 0.098217140329559660, + 0.049167674327417023, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + -0.881112264348355050, + -0.514102744193221328, + -0.477396736825997198, + -0.477555093430281585, + -0.387688432365089171, + -0.335879853392219440, + -0.295878677254461665, + -0.242980179903263122, + -0.195057822016127443, + -0.146775474455360860, + -0.098897540329559660, + -0.042866864327417023, + 0.998795456205172405, + 0.995184726672196929, + 0.989576509964781014, + 0.654634123783645266, + 0.634646284163645266, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + -0.980782180403230431, + -0.831465612302545236, + -0.803205431480644943, + -0.774010453362736882, + -0.747954125354958995, + -0.707116781186547351, + -0.671125754847018219, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + 0.336441853392219440, + 0.740451125354958995, + 0.707106781186547351, + 0.903989293123443338, + 0.471356736825997198, + 0.998795456205172405, + 0.995184726672196929, + 0.956940335252408824, + 0.941544045483020806, + 0.923879532511286738, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.336441853392219440, + 0.290284654254461665, + 0.242980479903263122, + 0.195094322016127443, + 0.146735474455360860, + 0.098217140329559660, + 0.049167674327417023, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + -0.980782180403230431, + -0.974034153194543974, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + 0.707106781186547351, + 0.671558954847018219, + 0.989576509964781014, + 0.980784545503230431, + 0.970031253194543974, + 0.654634123783645266, + 0.634646284163645266, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + -0.881112264348355050, + -0.857728610000272118, + -0.831465612302545236, + -0.803205431480644943, + -0.774010453362736882, + -0.747954125354958995, + -0.707116781186547351, + -0.671125754847018219, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + -0.514102744193221328, + -0.477396736825997198, + -0.477555093430281585, + -0.387688432365089171, + -0.335879853392219440, + -0.295878677254461665, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + -0.242980179903263122, + -0.195057822016127443, + -0.146775474455360860, + -0.098897540329559660, + -0.042866864327417023, + 0.998795456205172405, + 0.995184726672196929, + 0.989576509964781014, + 0.980784545503230431, + 0.970031253194543974, + 0.956940335252408824, + 0.941544045483020806, + 0.923879532511286738, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + -0.980782180403230431, + -0.974034153194543974, + 0.707106781186547351, + 0.671558954847018219, + 0.654634123783645266, + 0.634646284163645266, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + 0.336441853392219440, + 0.290284654254461665, + 0.242980479903263122, + 0.195094322016127443, + 0.146735474455360860, + 0.098217140329559660, + 0.049167674327417023, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + -0.881112264348355050, + -0.514102744193221328, + -0.477396736825997198, + -0.477555093430281585, + -0.387688432365089171, + -0.335879853392219440, + -0.295878677254461665, + -0.242980179903263122, + -0.195057822016127443, + -0.146775474455360860, + -0.098897540329559660, + -0.042866864327417023, + 0.998795456205172405, + 0.995184726672196929, + 0.989576509964781014, + 0.980784545503230431, + 0.290284654254461665, + 0.242980479903263122, + 0.195094322016127443, + 0.146735474455360860, + 0.098217140329559660, + 0.049167674327417023, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + -0.514102744193221328, + -0.477396736825997198, + -0.477555093430281585, + -0.387688432365089171, + -0.335879853392219440, + -0.295878677254461665, + -0.242980179903263122, + -0.195057822016127443, + -0.146775474455360860, + -0.098897540329559660, + -0.042866864327417023, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + 0.881541264344545050, + 0.857728610000272118, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + 0.336441853392219440, + 0.290284654254461665, + 0.098217140329559660, + 0.049167674327417023, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + -0.974034153194543974, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + -0.881112264348355050, + -0.857728610000272118, + -0.831465612302545236, + 0.923879532511286738, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.803207531420452543, + 0.773010453362736882, + 0.970031253194543974, + 0.956940335252408824, + -0.857728610000272118, + -0.831465612302545236, + -0.803205431480644943, + -0.774010453362736882, + -0.747954125354958995, + -0.707116781186547351, + -0.671125754847018219, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + 0.941544045483020806, + 0.923879532511286738, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + 0.707106781186547351, + -0.974034153194543974, + -0.956940335732208824, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + -0.881112264348355050, + -0.857728610000272118, + 0.671558954847018219, + 0.654634123783645266, + 0.634646284163645266, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + -0.980782180403230431, + -0.831465612302545236, + -0.803205431480644943, + -0.774010453362736882, + -0.747954125354958995, + -0.707116781186547351, + -0.671125754847018219, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + 0.336441853392219440, + 0.290284654254461665, + 0.242980479903263122, + 0.195094322016127443, + 0.146735474455360860, + 0.098217140329559660, + 0.049167674327417023, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + -0.514102744193221328, + -0.477396736825997198, + -0.477555093430281585, + -0.387688432365089171, + -0.335879853392219440, + -0.295878677254461665, + -0.242980179903263122, + -0.195057822016127443, + -0.146775474455360860, + -0.098897540329559660, + -0.042866864327417023, + 0.595624504492433024, + 0.555570245019601845, + 0.514442744193221328, + -0.001212000000001049, + -0.998791456205172405, + -0.995214726672196929, + -0.989176509964781014, + 0.881541264344545050, + 0.857728610000272118, + 0.471356736825997198, + 0.424551093430281585, + 0.314683432365089171, + 0.336441853392219440, + 0.290284654254461665, + 0.098217140329559660, + 0.049167674327417023, + -0.634394284163645266, + -0.594619304492433024, + -0.555545233019601845, + -0.974034153194543974, + -0.956940335732208824, + 0.956940335252408824, + 0.941544045483020806, + 0.923879532511286738, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.336441853392219440, + 0.290284654254461665, + 0.242980479903263122, + 0.195094322016127443, + -0.944144065183020806, + -0.923211532511286738, + -0.905989293123443338, + -0.881112264348355050, + -0.857728610000272118, + -0.831465612302545236, + 0.923879532511286738, + 0.903989293123443338, + 0.881541264344545050, + 0.857728610000272118, + 0.831469612544545236, + 0.803207531420452543, + 0.773010453362736882, + 0.740451125354958995, + 0.707106781186547351, + 0.903989293123443338, + 0.471356736825997198, + }; + + +void BenchFFT( void ) +{ + int i; + int k; + FFT fft; + + fft.N = OBJ_DATA_COUNT; + fft.r = OBJ_DATA_SISU; + fft.result_A = SpectA; + fft.result_B = SpectB; + + for ( i= 0 ; i < FFT_TEST_COUNT ; i++ ) + { + for( k= 0 ; k < fft.N ; k++ ) + { + fft.result_A[k] = TestData[i+k]; + } + digital_fft( &fft ); + } + return; +} + + + +void digital_fft( FFT* fft ) +{ + int col; // 「列」番号 + int g; // グループ番号 + int i; // グループで行う複素乗算回数 + int group_count; // 何グループ存在するか + int group_item; // グループ内にいくつの要素が存在するか + int mul_count; // 複素乗算回数 + int pair_plus; // バタフライ演算で求めたデータの対になる番号に足す値 + int pair1; // バタフライ演算で求める1つ目の番号 + int pair2; // バタフライ演算で求める2つ目の番号 + int j; + int k; + int w; // ビットを反転した結果 + int bit; + int mask; + int set; + double radian; + double rad; + double wk_cos; + double wk_sin; + double wk_A; + double wk_B; + + // ---------------------------------------------- データ初期設定 + for ( i= 0 ; i < fft->N ; i++ ) + { + fft->result_B[i] = 0; + } + + group_count = 1; + mul_count = fft->N / 2; + pair_plus = fft->N / 2; + radian = 2 * M_PI / fft->N; + // --------------------------------------------- r回「列」計算を行う + for ( col= 0 ; col < fft->r ; col++ ) + { + rad = 0.0; + // ----------------------------------------- グループで行う複素乗算回数 + for ( i= 0 ; i < mul_count ; i++ ) + { + wk_cos = cos( rad ); + wk_sin = sin( rad ); + rad += radian; + + group_item = mul_count + mul_count; + pair1 = i; + + // ------------------------------------ グループの数分行う + for ( g= 0 ; g < group_count ; g++ ) + { + // -------------------------------- 「列」計算の対になるもう1つの番号を求める + pair2 = pair1 + pair_plus; + + wk_A = fft->result_A[pair1] - fft->result_A[pair2]; + wk_B = fft->result_B[pair1] - fft->result_B[pair2]; + fft->result_A[pair1] = fft->result_A[pair1] + fft->result_A[pair2]; + fft->result_B[pair1] = fft->result_B[pair1] + fft->result_B[pair2]; + fft->result_A[pair2] = wk_cos * wk_A + wk_sin * wk_B; + fft->result_B[pair2] = wk_cos * wk_B - wk_sin * wk_A; + + // -------------------------------- 次のグループの先頭位置の番号をセット + pair1 += group_item; + } + } + group_count += group_count; // グループ数は「列」毎に2倍に増えていく + mul_count /= 2; // グループで行う複素乗算回数は「列」毎に1/2になる + pair_plus /= 2; // 対になるデータの位置は「列」毎に1/2になる + radian += radian; + } + + // --------------------------------------------- データのビット順を元に戻す + for ( i= 0 ; i < fft->N - 1 ; i++ ) + { + mask = 1; // チェックするビット + set = 1 << ( fft->r-1 ); // ( fft->r-1 ) 分左へシフト + w = 0; + + for ( j= 0, k= fft->r ; k > 0 ; j++, k-- ) + { + bit = i & mask; + if ( bit ) + w |= set; + mask <<= 1; + set >>= 1; + } + if ( w <= i ) // update 1994.04.02 全データをリバースしていたため元に戻っていた + continue; + + wk_A = fft->result_A[i]; + wk_B = fft->result_B[i]; + fft->result_A[i] = fft->result_A[w]; + fft->result_A[w] = wk_A; + fft->result_B[i] = fft->result_B[w]; + fft->result_B[w] = wk_B; + } +} 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 @@ -27,6 +27,7 @@ #include "storage.h" #include "processinfo.h" #include "modulesinfo.h" +#include "benchmarkinfo.h" #include "versioninfo.h" #include "sysinfo.h" @@ -52,6 +53,7 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) QVBoxLayout *lay = new QVBoxLayout( this ); OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); lay->addWidget( tab ); + tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") ); #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) tab->addTab( new FileSysInfo( tab ), "sysinfo/storagetabicon", tr("Storage") ); @@ -62,6 +64,7 @@ SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr("Process") ); tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr("Modules") ); } + tab->addTab( new BenchmarkInfo( tab ), "sysinfo/benchmarktabicon", tr( "Benchmark" ) ); tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); tab->setCurrentTab( tr( "Memory" ) ); 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 @@ -6,6 +6,7 @@ HEADERS = memory.h \ processinfo.h \ modulesinfo.h \ detail.h \ + benchmarkinfo.h \ versioninfo.h \ sysinfo.h SOURCES = main.cpp \ @@ -16,12 +17,13 @@ SOURCES = main.cpp \ processinfo.cpp \ modulesinfo.cpp \ detail.cpp \ + benchmarkinfo.cpp fft.c \ versioninfo.cpp \ sysinfo.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 TARGET = sysinfo -- cgit v0.9.0.2