示例#1
0
int main(int argc, char **argv, char **envp)
{
  if (argc<2) {
    fprintf(stderr,"Usage:\n\t%s <router.conf>\n", argv[0]);
    exit(0);
  }

  Report::openFile("netBench.log");
  
  SescConf = new SConfig(argv[1]);   // First thing to do

  net = new InterConnection("network1");

  nRouters = net->getnRouters();
  
  for(size_t i=0 ; i<nRouters ; i++ ) {
    ProtocolA *p = new ProtocolA(net, i);
    pa.push_back(p);
  }
  
  printf("System ready\n");

  fprintf(stderr,"Bench two neighbours message...");
  startBench();
  bench1();
  fprintf(stderr,"done\n");
  endBench("bench1");

  fprintf(stderr,"Bench heavy traffic...");
  startBench();
  bench2();
  fprintf(stderr,"done\n");
  endBench("bench2");

  fprintf(stderr,"Mix Benchmark...");
  startBench();
  bench2();
  printf("one\n");
  bench2();
  printf("two\n");
  bench1();
  printf("three\n");
  bench2();
  fprintf(stderr,"done\n");
  endBench("bench3");

  for(int k = 0; k < TIME_BUBBLE*100 ; k++) {
    EventScheduler::advanceClock();
  }

  GStats::report("netBench stats");
  Report::close();
}
示例#2
0
void benchMatrix(const char *str)
{
  MSG("Benchmark a code like a matrix multiply: %s", str);

  startBench();

  MyCacheType::CacheLine *line;

  for(int i=0;i<MSIZE;i++) {
    for(int j=0;j<MSIZE;j++) {
      // A[i][j]=0;

      // A[i][j]=...
      line = cache->writeLine((long)&A[i][j]);
      nAccess++;
      if (line==0) {
	cache->fillLine((long)&A[i][j]);
	nAccess++;
      }

      for(int k=0;k<MSIZE;k++) {
	// A[i][j] += B[i][j]*C[j][k];

	// = ... A[i][j]
	line = cache->readLine((long)&A[i][j]);
	nAccess++;
	if (line==0) {
	  cache->fillLine((long)&A[i][j]);
	  nAccess++;
	}

	// = ... B[i][j]
	line = cache->readLine((long)&B[i][j]);
	nAccess++;
	if (line==0) {
	  cache->fillLine((long)&B[i][j]);
	  nAccess++;
	}

	// = ... C[i][j]
	line = cache->readLine((long)&C[i][j]);
	nAccess++;
	if (line==0) {
	  cache->fillLine((long)&C[i][j]);
	  nAccess++;
	}

	// A[i][j]=...;
	line = cache->writeLine((long)&A[i][j]);
	nAccess++;
	if (line==0) {
	  cache->fillLine((long)&A[i][j]);
	  nAccess++;
	}
      }
    }
  }

  endBench(str);
}
示例#3
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , m_progress(new QProgressDialog(this))

{
    ui->setupUi(this);
    m_progress->setWindowModality(Qt::WindowModal);
    m_progress->setRange(0, 100);
    m_progress->setCancelButton(0);
    m_progress->setLabelText("Working on Fourier Transformation...");
    m_progress->cancel();

    for (int i = 0; i < FT::FTTYPECOUNT; ++i) {
        QString text;

        switch (i) {
        case FT::DFTCPU:
            text = QStringLiteral("DFT CPU");
            break;
        case FT::DFTGPU:
            text = QStringLiteral("DFT GPU");
            break;
        case FT::FFTCPU:
            text = QStringLiteral("FFT CPU");
            break;
        case FT::FFTGPU:
            text = QStringLiteral("FFT GPU");
            break;
        default:
            text = QStringLiteral("Unknown");
        }

        ui->refFtCombo->insertItem(i, text);
        ui->modFtCombo->insertItem(i, text);
        ui->benchFtCombo->insertItem(i, text);
    }

    ui->refFtCombo->setCurrentIndex(FT::FFTCPU);
    ui->refElapsedLabel->setStyleSheet("QLabel { color: red; }");
    ui->modFtCombo->setCurrentIndex(FT::FFTGPU);
    ui->modElapsedLabel->setStyleSheet("QLabel { color: red; }");
    ui->benchFtCombo->setCurrentIndex(FT::FFTGPU);

    ui->compareInputLine->setText(QStringLiteral(":/images/qt-logo-128.png"));
    ui->benchInputLine->setText(QStringLiteral("rect-128-128-32-16-50-200"));

    ui->benchResultView->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));

    connect(ui->browseButton, SIGNAL(pressed()), this, SLOT(showImageBrowser()));
    connect(ui->compareRectButton, SIGNAL(pressed()), this, SLOT(showRectDialogForCompare()));
    connect(ui->benchRectButton, SIGNAL(pressed()), this, SLOT(showRectDialogForBench()));

    rangeMinSBPrevValue = ui->rangeMinSB->value();
    connect(ui->rangeMinSB, SIGNAL(valueChanged(int)), this, SLOT(roundSBToPowerOfTwo(int)));
    rangeMaxSBPrevValue = ui->rangeMaxSB->value();
    connect(ui->rangeMaxSB, SIGNAL(valueChanged(int)), this, SLOT(roundSBToPowerOfTwo(int)));

    connect(ui->startCompareButton, SIGNAL(pressed()), m_progress, SLOT(show()));
    connect(ui->startCompareButton, SIGNAL(pressed()), this, SLOT(startCompare()));

    connect(ui->startBenchButton, SIGNAL(pressed()), m_progress, SLOT(show()));
    connect(ui->startBenchButton, SIGNAL(pressed()), this, SLOT(startBench()));
}