Files
DRAMSys/analyzer/analyzer/traceanalyzer.cpp
Éder Ferreira Zulian ae5a1ff76f Janik Schlemminger and Robert Gernhardt added as authors.
Matthias Jung, Janik Schlemminger and Robert Gernhardt were used as authors
for all files wihout an author/header.

Also, removed headers from files that already had a license statement:
dram.vp.system/analyzer/analyzer/thirdParty/*
2015-05-18 12:48:20 +02:00

147 lines
4.1 KiB
C++

/*
* Copyright (c) 2015, University of Kaiserslautern
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors:
* Janik Schlemminger
* Robert Gernhardt
* Matthias Jung
*/
#include "traceanalyzer.h"
#include "ui_traceanalyzer.h"
#include "tracefiletab.h"
#include <QFileDialog>
#include <QFileInfo>
#include <QDateTime>
#include "QMessageBox"
#include <iostream>
void TraceAnalyzer::setUpStatusBar()
{
statusLabel = new QLabel(this);
statusBar()->addWidget(statusLabel);
}
void TraceAnalyzer::setUpGui()
{
ui->setupUi(this);
setUpStatusBar();
ui->traceFileTabs->clear();
}
TraceAnalyzer::TraceAnalyzer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TraceAnalyzer)
{
setUpGui();
}
TraceAnalyzer::TraceAnalyzer(QSet<QString> paths, StartupOption option, QWidget *parent):
QMainWindow(parent),
ui(new Ui::TraceAnalyzer)
{
setUpGui();
for(const QString& path : paths)
openTracefile(path);
if(option == StartupOption::runTests)
{
ui->actionTest->trigger();
}
}
TraceAnalyzer::~TraceAnalyzer()
{
delete ui;
}
void TraceAnalyzer::on_actionOpen_triggered()
{
QStringList paths = QFileDialog::getOpenFileNames(this,tr("Open Tracefile"),"",tr("Tracefile(*.tdb)"));
if(paths.isEmpty())
return;
for(const QString &path: paths)
{
openTracefile(path);
}
}
void TraceAnalyzer::openTracefile(const QString &path)
{
if(openedTraceFiles.contains(path))
return;
TraceFileTab* tab = new TraceFileTab(this, path);
connect(tab, SIGNAL(statusChanged(QString)), this, SLOT(statusChanged(QString)));
ui->traceFileTabs->addTab(tab,QFileInfo(path).baseName());
openedTraceFiles.insert(path);
}
void TraceAnalyzer::on_traceFileTabs_tabCloseRequested(int index)
{
TraceFileTab* traceFileTab = static_cast<TraceFileTab*>(ui->traceFileTabs->widget(index));
openedTraceFiles.remove(traceFileTab->getPathToTraceFile());
ui->traceFileTabs->removeTab(index);
delete traceFileTab;
}
void TraceAnalyzer::on_actionClose_all_triggered()
{
while(ui->traceFileTabs->count())
on_traceFileTabs_tabCloseRequested(0);
}
void TraceAnalyzer::statusChanged(QString message)
{
statusLabel->setText(message + " - (" + QTime::currentTime().toString() + ")");
}
void TraceAnalyzer::on_actionTest_triggered()
{
evaluationTool.raise();
evaluationTool.activateWindow();
evaluationTool.showAndRunTests(openedTraceFiles.toList());
}
void TraceAnalyzer::on_actionMetrics_triggered()
{
evaluationTool.raise();
evaluationTool.activateWindow();
evaluationTool.showAndEvaluateMetrics(openedTraceFiles.toList());
}