Merge branch 'work/TraceAnalyzer_enhancements' into 'develop'
TraceAnalyzer changes See merge request ems/astdm/modeling.dram/dram.sys!357
This commit is contained in:
@@ -95,9 +95,7 @@ add_executable(TraceAnalyzer
|
||||
selectmetrics.cpp
|
||||
presentation/util/testlight.cpp
|
||||
presentation/util/togglecollapsedaction.cpp
|
||||
presentation/tracetesttreewidget.cpp
|
||||
businessObjects/pythoncaller.cpp
|
||||
businessObjects/tracetestresults.cpp
|
||||
presentation/tracemetrictreewidget.cpp
|
||||
businessObjects/phases/phase.cpp
|
||||
businessObjects/phases/phasedependency.cpp
|
||||
|
||||
@@ -52,8 +52,6 @@ PythonCaller &PythonCaller::instance()
|
||||
}
|
||||
|
||||
PythonCaller::PythonCaller() :
|
||||
testModuleName("tests"),
|
||||
testFunctionName("runTests"),
|
||||
metricModuleName("metrics"),
|
||||
metricFunctionName("calculateMetrics"),
|
||||
getMetricFunctionName("getMetrics"),
|
||||
@@ -73,13 +71,11 @@ PythonCaller::PythonCaller() :
|
||||
PyList_Insert(sysPath, 0, path);
|
||||
Py_DECREF(path);
|
||||
|
||||
qDebug() << "Test:" << testModuleName.c_str() << testFunctionName.c_str();
|
||||
qDebug() << "Metric:" << metricModuleName.c_str() << metricFunctionName.c_str();
|
||||
qDebug() << "Plot:" << plotsModuleName.c_str() << plotsFunctionName.c_str();
|
||||
qDebug() << "VcdExport:" << vcdExportModuleName.c_str() << vcdExportFunctionName.c_str();
|
||||
qDebug() << "Script: " << pathToScripts.c_str();
|
||||
|
||||
pRunTestsFunction = loadFunctionFromModule(testModuleName, testFunctionName);
|
||||
pCalculateMetricsFunction = loadFunctionFromModule(metricModuleName,
|
||||
metricFunctionName);
|
||||
pGenPlotsFunction = loadFunctionFromModule(plotsModuleName, plotsFunctionName);
|
||||
@@ -119,7 +115,6 @@ PyObject *PythonCaller::loadFunctionFromModule(std::string moduleName, std::stri
|
||||
|
||||
PythonCaller::~PythonCaller()
|
||||
{
|
||||
Py_DECREF(pRunTestsFunction);
|
||||
Py_DECREF(pCalculateMetricsFunction);
|
||||
Py_DECREF(pGenPlotsFunction);
|
||||
Py_DECREF(pGetMetricsFunction);
|
||||
@@ -149,7 +144,8 @@ PyObject *PythonCaller::callMetricsFunction(PyObject *function, QString argument
|
||||
|
||||
if (!pResult) {
|
||||
PyErr_Print();
|
||||
throw std::runtime_error(std::string("Error in calling " + testFunctionName + " in module " + testModuleName));
|
||||
throw std::runtime_error(
|
||||
std::string("Error in calling " + metricFunctionName + " in module " + metricModuleName));
|
||||
}
|
||||
|
||||
return pResult;
|
||||
@@ -169,7 +165,7 @@ PyObject *PythonCaller::callFunctionWithStringArgument(PyObject *function,
|
||||
|
||||
if (!pResult) {
|
||||
PyErr_Print();
|
||||
throw std::runtime_error(std::string("Error in calling " + testFunctionName + " in module " + testModuleName));
|
||||
throw std::runtime_error(std::string("Error in calling function with string argument"));
|
||||
}
|
||||
|
||||
return pResult;
|
||||
@@ -188,24 +184,6 @@ PyObject *PythonCaller::callFunctionWithoutArguments(PyObject *function)
|
||||
return pResult;
|
||||
}
|
||||
|
||||
TraceTestResults PythonCaller::runTestsOnTrace(QString pathToTrace)
|
||||
{
|
||||
TraceTestResults traceTestResult(QFileInfo(pathToTrace).baseName());
|
||||
PyObject *pResult = callFunctionWithStringArgument(pRunTestsFunction,
|
||||
pathToTrace);
|
||||
|
||||
for (Py_ssize_t i = 0; i < PyList_Size(pResult); ++i) {
|
||||
PyObject *currentTestResult = PyList_GetItem(pResult, i);
|
||||
QString testName(PyUnicode_AsUTF8(PyTuple_GetItem(currentTestResult, 0)));
|
||||
bool testPassed = (Py_True == PyTuple_GetItem(currentTestResult, 1));
|
||||
QString message(PyUnicode_AsUTF8(PyTuple_GetItem(currentTestResult, 2)));
|
||||
|
||||
traceTestResult.addTestResult(TestResult(testName, testPassed, message));
|
||||
}
|
||||
Py_DECREF(pResult);
|
||||
return traceTestResult;
|
||||
}
|
||||
|
||||
TraceCalculatedMetrics PythonCaller::calculateMetricsOnTrace(QString pathToTrace, std::vector<long> list)
|
||||
{
|
||||
TraceCalculatedMetrics result(QFileInfo(pathToTrace).baseName());
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <QString>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "businessObjects/tracetestresults.h"
|
||||
#include "businessObjects/tracecalculatedmetrics.h"
|
||||
|
||||
class PythonCaller
|
||||
@@ -57,7 +56,6 @@ class PythonCaller
|
||||
public:
|
||||
static PythonCaller &instance();
|
||||
|
||||
TraceTestResults runTestsOnTrace(QString pathToTrace);
|
||||
TraceCalculatedMetrics calculateMetricsOnTrace(QString pathToTrace,
|
||||
std::vector<long> list);
|
||||
std::vector<std::string> getMetrics(QString pathToTrace);
|
||||
@@ -72,14 +70,13 @@ private:
|
||||
PythonCaller(const PythonCaller &other) = delete;
|
||||
PythonCaller &operator=(const PythonCaller &other) = delete;
|
||||
|
||||
PyObject *pRunTestsFunction, *pCalculateMetricsFunction, *pGetMetricsFunction;
|
||||
PyObject *pCalculateMetricsFunction, *pGetMetricsFunction;
|
||||
PyObject *pGenPlotsFunction;
|
||||
PyObject *pVcdExportFunction = nullptr;
|
||||
PyObject *pVcdExportDependenciesFunction;
|
||||
PyObject *loadFunctionFromModule(std::string moduleName,
|
||||
std::string functionName);
|
||||
std::string testModuleName, testFunctionName, metricModuleName,
|
||||
metricFunctionName, getMetricFunctionName, pathToScripts;
|
||||
std::string metricModuleName, metricFunctionName, getMetricFunctionName, pathToScripts;
|
||||
std::string plotsModuleName;
|
||||
std::string plotsFunctionName;
|
||||
|
||||
|
||||
@@ -356,14 +356,16 @@ QString AbstractTracePlotLineModel::getLabel(LineType type)
|
||||
}
|
||||
}
|
||||
|
||||
QString AbstractTracePlotLineModel::getLabel(unsigned int rank)
|
||||
QString AbstractTracePlotLineModel::getLabel(unsigned int rank) const
|
||||
{
|
||||
return "RA" + QString::number(rank);
|
||||
std::string_view rankLabel = dataBusType == DataBusType::LegacyMode ? "RA" : "PC";
|
||||
return rankLabel.data() + QString::number(rank);
|
||||
}
|
||||
|
||||
QString AbstractTracePlotLineModel::getLabel(unsigned int rank, unsigned int group, unsigned int bank)
|
||||
QString AbstractTracePlotLineModel::getLabel(unsigned int rank, unsigned int group, unsigned int bank) const
|
||||
{
|
||||
return "RA" + QString::number(rank) + " BG" + QString::number(group) + " BA" + QString::number(bank);
|
||||
std::string_view rankLabel = dataBusType == DataBusType::LegacyMode ? "RA" : "PC";
|
||||
return rankLabel.data() + QString::number(rank) + " BG" + QString::number(group) + " BA" + QString::number(bank);
|
||||
}
|
||||
|
||||
AbstractTracePlotLineModel::CommandBusType AbstractTracePlotLineModel::getCommandBusType(const GeneralInfo &generalInfo)
|
||||
|
||||
@@ -174,8 +174,8 @@ protected:
|
||||
std::shared_ptr<Node> createRankGroupNode(unsigned int rank) const;
|
||||
|
||||
static QString getLabel(LineType type);
|
||||
static QString getLabel(unsigned int rank);
|
||||
static QString getLabel(unsigned int rank, unsigned int group, unsigned int bank);
|
||||
QString getLabel(unsigned int rank) const;
|
||||
QString getLabel(unsigned int rank, unsigned int group, unsigned int bank) const;
|
||||
|
||||
static CommandBusType getCommandBusType(const GeneralInfo &generalInfo);
|
||||
static DataBusType getDataBusType(const GeneralInfo &generalInfo);
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Technische Universität 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 "tracetestresults.h"
|
||||
|
||||
|
||||
bool TraceTestResults::hasPassedAllTests() const
|
||||
{
|
||||
for (const TestResult &testResult : testResults) {
|
||||
if (!testResult.hasPassed())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Technische Universität 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
|
||||
*/
|
||||
|
||||
#ifndef TRACETESTRESULT_H
|
||||
#define TRACETESTRESULT_H
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
#include "testresult.h"
|
||||
|
||||
class TraceTestResults
|
||||
{
|
||||
public:
|
||||
TraceTestResults(const QString &traceName): traceName(traceName) {}
|
||||
|
||||
void addTestResult(const TestResult &result)
|
||||
{
|
||||
testResults.push_back(result);
|
||||
}
|
||||
|
||||
QString getTraceName() const
|
||||
{
|
||||
return traceName;
|
||||
}
|
||||
bool hasPassedAllTests() const;
|
||||
const std::vector<TestResult> &getTestResults() const
|
||||
{
|
||||
return testResults;
|
||||
}
|
||||
private:
|
||||
QString traceName;
|
||||
std::vector<TestResult> testResults;
|
||||
};
|
||||
|
||||
#endif // TRACETESTRESULT_H
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <QDebug>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <businessObjects/tracetestresults.h>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
@@ -61,8 +60,6 @@ EvaluationTool::EvaluationTool(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
traceFilesModel = new QStandardItemModel(this);
|
||||
ui->listView->setModel(traceFilesModel);
|
||||
QObject::connect(ui->traceTestTreeWidget, SIGNAL(setMessage(QString)), this,
|
||||
SLOT(setTestMessage(QString)));
|
||||
selectMetrics = new SelectMetrics(this);
|
||||
QObject::connect(selectMetrics, SIGNAL(getSelectedMetrics()), this,
|
||||
SLOT(getSelectedMetrics()));
|
||||
@@ -81,16 +78,6 @@ void EvaluationTool::showForFiles(QList<QString> paths)
|
||||
ui->toolBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void EvaluationTool::showAndRunTests(QList<QString> paths)
|
||||
{
|
||||
cleanUpUI();
|
||||
fillFileList(paths);
|
||||
show();
|
||||
ui->toolBox->setCurrentIndex(0);
|
||||
selectMetrics->setMetrics(getMetrics());
|
||||
runTests();
|
||||
}
|
||||
|
||||
void EvaluationTool::showAndEvaluateMetrics(QList<QString> paths)
|
||||
{
|
||||
cleanUpUI();
|
||||
@@ -118,9 +105,6 @@ void EvaluationTool::cleanUpUI()
|
||||
traceFilesModel->clear();
|
||||
calculatedMetrics.clear();
|
||||
ui->traceMetricTreeWidget->clear();
|
||||
ui->traceTestTreeWidget->clear();
|
||||
ui->testMessage->setPlainText(QString(""));
|
||||
ui->testLight->setGray();
|
||||
}
|
||||
|
||||
void EvaluationTool::fillFileList(QList<QString> paths)
|
||||
@@ -134,43 +118,6 @@ void EvaluationTool::fillFileList(QList<QString> paths)
|
||||
}
|
||||
}
|
||||
|
||||
void EvaluationTool::on_btn_test_clicked()
|
||||
{
|
||||
runTests();
|
||||
}
|
||||
|
||||
void EvaluationTool::runTests()
|
||||
{
|
||||
ui->traceTestTreeWidget->clear();
|
||||
ui->testLight->setGray();
|
||||
|
||||
bool allTestsPassed = true;
|
||||
bool boxesChecked = false;
|
||||
|
||||
for (int row = 0; row < traceFilesModel->rowCount(); ++row)
|
||||
{
|
||||
TraceFileItem *item = static_cast<TraceFileItem *>(traceFilesModel->item(row));
|
||||
if (item->checkState() == Qt::Checked)
|
||||
{
|
||||
boxesChecked = true;
|
||||
TraceTestResults traceTestResult = PythonCaller::instance().runTestsOnTrace(item->getPath());
|
||||
if (!traceTestResult.hasPassedAllTests())
|
||||
allTestsPassed = false;
|
||||
ui->traceTestTreeWidget->addTraceTestResult(traceTestResult);
|
||||
}
|
||||
}
|
||||
|
||||
if (!boxesChecked)
|
||||
return;
|
||||
|
||||
ui->traceTestTreeWidget->expandAll();
|
||||
|
||||
if (allTestsPassed)
|
||||
ui->testLight->setGreen();
|
||||
else
|
||||
ui->testLight->setRed();
|
||||
}
|
||||
|
||||
void EvaluationTool::on_btn_calculateMetrics_clicked()
|
||||
{
|
||||
selectMetrics->raise();
|
||||
@@ -203,11 +150,6 @@ void EvaluationTool::calculateMetrics(vector<long> selectedMetrics)
|
||||
ui->traceMetricTreeWidget->expandAll();
|
||||
}
|
||||
|
||||
void EvaluationTool::setTestMessage(QString message)
|
||||
{
|
||||
ui->testMessage->setPlainText(message);
|
||||
}
|
||||
|
||||
EvaluationTool::TraceFileItem::TraceFileItem(const QString &path)
|
||||
{
|
||||
this->path = path;
|
||||
|
||||
@@ -65,21 +65,16 @@ public:
|
||||
~EvaluationTool();
|
||||
|
||||
void showForFiles(QList<QString> paths);
|
||||
void showAndRunTests(QList<QString> paths);
|
||||
void showAndEvaluateMetrics(QList<QString> paths);
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_btn_test_clicked();
|
||||
void setTestMessage(QString message);
|
||||
void on_btn_calculateMetrics_clicked();
|
||||
void on_btn_exportCSV_clicked();
|
||||
void on_btn_genPlots_clicked();
|
||||
void getSelectedMetrics();
|
||||
|
||||
|
||||
private:
|
||||
void fillFileList(QList<QString> paths);
|
||||
void runTests();
|
||||
void cleanUpUI();
|
||||
void genPlots();
|
||||
void calculateMetrics(std::vector<long> selectedMetrics);
|
||||
|
||||
@@ -38,78 +38,15 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>702</width>
|
||||
<height>436</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Test</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="TraceTestTreeWidget" name="traceTestTreeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_test">
|
||||
<property name="text">
|
||||
<string>Run tests</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="TestLight" name="testLight" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Message: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="testMessage"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>702</width>
|
||||
<height>436</height>
|
||||
<width>707</width>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@@ -176,17 +113,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TestLight</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>presentation/util/testlight.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TraceTestTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>presentation/tracetesttreewidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TraceMetricTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Technische Universität 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 "tracetesttreewidget.h"
|
||||
|
||||
TraceTestTreeWidget::TraceTestTreeWidget(QWidget *parent) : QTreeWidget(parent)
|
||||
{
|
||||
QObject::connect(this, SIGNAL(itemSelectionChanged()), this,
|
||||
SLOT(itemSelectionChanged()));
|
||||
setHeaderHidden(true);
|
||||
}
|
||||
|
||||
void TraceTestTreeWidget::addTraceTestResult(const TraceTestResults
|
||||
&traceTestResult)
|
||||
{
|
||||
QTreeWidgetItem *top = new QTreeWidgetItem({traceTestResult.getTraceName()});
|
||||
addTopLevelItem(top);
|
||||
|
||||
if (traceTestResult.hasPassedAllTests())
|
||||
top->setForeground(0, Qt::green);
|
||||
else
|
||||
top->setForeground(0, Qt::red);
|
||||
|
||||
for (const TestResult &testResult : traceTestResult.getTestResults()) {
|
||||
new TestResultTreeItem(top, testResult);
|
||||
}
|
||||
}
|
||||
|
||||
void TraceTestTreeWidget::itemSelectionChanged()
|
||||
{
|
||||
if (!selectedItems().isEmpty()
|
||||
&& selectedItems().at(0)->type() ==
|
||||
TestResultTreeItem::testResultTreeItemType) {
|
||||
TestResultTreeItem *testResultItem = static_cast<TestResultTreeItem *>
|
||||
(selectedItems().at(0));
|
||||
Q_EMIT setMessage(testResultItem->getMessage());
|
||||
} else {
|
||||
setMessage(QString(""));
|
||||
}
|
||||
}
|
||||
|
||||
TraceTestTreeWidget::TestResultTreeItem::TestResultTreeItem(
|
||||
QTreeWidgetItem *parent, const TestResult &testResult)
|
||||
: QTreeWidgetItem(parent, testResultTreeItemType)
|
||||
{
|
||||
setText(0, testResult.getTestName());
|
||||
if (!testResult.hasPassed())
|
||||
setForeground(0, Qt::red);
|
||||
message = testResult.getMessage();
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Technische Universität 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
|
||||
*/
|
||||
|
||||
#ifndef TRACETESTTREEWIDGET_H
|
||||
#define TRACETESTTREEWIDGET_H
|
||||
#include <QTreeWidget>
|
||||
#include <businessObjects/tracetestresults.h>
|
||||
|
||||
class TraceTestTreeWidget: public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TraceTestTreeWidget(QWidget *parent = 0);
|
||||
void addTraceTestResult(const TraceTestResults &traceTestResult);
|
||||
|
||||
Q_SIGNALS:
|
||||
void setMessage(QString message);
|
||||
|
||||
private:
|
||||
class TestResultTreeItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
TestResultTreeItem(QTreeWidgetItem *parent, const TestResult &testResult);
|
||||
static constexpr int testResultTreeItemType = 1002;
|
||||
QString getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
private:
|
||||
QString message;
|
||||
};
|
||||
|
||||
private Q_SLOTS:
|
||||
void itemSelectionChanged();
|
||||
};
|
||||
|
||||
#endif // TRACETESTTREEWIDGET_H
|
||||
@@ -77,9 +77,6 @@ TraceAnalyzer::TraceAnalyzer(QSet<QString> paths, StartupOption option,
|
||||
|
||||
for (const QString &path : paths)
|
||||
openTracefileTab(path);
|
||||
|
||||
if (option == StartupOption::runTests)
|
||||
ui->actionTest->trigger();
|
||||
}
|
||||
|
||||
TraceAnalyzer::~TraceAnalyzer()
|
||||
@@ -245,13 +242,6 @@ void TraceAnalyzer::statusChanged(const QString &message)
|
||||
statusLabel->setText(message + QTime::currentTime().toString());
|
||||
}
|
||||
|
||||
void TraceAnalyzer::on_actionTest_triggered()
|
||||
{
|
||||
evaluationTool.raise();
|
||||
evaluationTool.activateWindow();
|
||||
evaluationTool.showAndRunTests(openedTraceFiles.values());
|
||||
}
|
||||
|
||||
void TraceAnalyzer::on_actionMetrics_triggered()
|
||||
{
|
||||
evaluationTool.raise();
|
||||
|
||||
@@ -92,7 +92,6 @@ private Q_SLOTS:
|
||||
void on_actionReload_triggered();
|
||||
void on_actionReload_all_triggered();
|
||||
void on_actionExportAsVCD_triggered();
|
||||
void on_actionTest_triggered();
|
||||
void on_actionMetrics_triggered();
|
||||
void on_actionClose_triggered();
|
||||
void on_actionClose_all_triggered();
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>23</height>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@@ -64,7 +64,6 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExportAsVCD"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionTest"/>
|
||||
<addaction name="actionMetrics"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionClose"/>
|
||||
@@ -234,7 +233,8 @@
|
||||
</action>
|
||||
<action name="actionSimulate">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run"/>
|
||||
<iconset theme="system-run">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Simulate...</string>
|
||||
|
||||
@@ -86,14 +86,6 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path)
|
||||
std::cout << "Opening new tab for \"" << path.toStdString() << "\"" <<
|
||||
std::endl;
|
||||
|
||||
initNavigatorAndItsDependentWidgets(path);
|
||||
setUpFileWatcher(path);
|
||||
setUpTraceplotScrollbar();
|
||||
setUpTraceSelector();
|
||||
setUpCommentView();
|
||||
|
||||
setUpPossiblePhases();
|
||||
|
||||
ui->mcConfigView->setModel(mcConfigModel);
|
||||
ui->mcConfigView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
||||
@@ -109,6 +101,8 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path)
|
||||
setUpTraceplotScrollbar();
|
||||
setUpCommentView();
|
||||
|
||||
setUpPossiblePhases();
|
||||
|
||||
tracefileChanged();
|
||||
}
|
||||
|
||||
@@ -491,6 +485,7 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
data->setSamples(*samples);
|
||||
cur->setData(data);
|
||||
cur->attach(ui->powerPlot);
|
||||
cur->setPen(QPen(QColor(255,0,0)));
|
||||
|
||||
QwtPlotMagnifier *mag1 = new QwtPlotMagnifier(ui->powerPlot->canvas());
|
||||
mag1->setAxisEnabled(QwtPlot::xBottom, true);
|
||||
@@ -519,6 +514,7 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
data2->setSamples(*samples2);
|
||||
cur2->setData(data2);
|
||||
cur2->attach(ui->bandwidthPlot);
|
||||
cur2->setPen(QPen(QColor(255,0,0)));
|
||||
|
||||
ui->bandwidthPlot->setAxisTitle(0,"Bandwidth [%]");
|
||||
ui->bandwidthPlot->setAxisScale(0,0.0,100.0);
|
||||
@@ -563,6 +559,7 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
|
||||
data3->setSamples(*samples3);
|
||||
cur3->setData(data3);
|
||||
cur3->attach(ui->bufferPlot);
|
||||
cur3->setPen(QPen(QColor(255,0,0)));
|
||||
|
||||
ui->bufferPlot->setAxisTitle(0,"Buffer Utilization");
|
||||
ui->bufferPlot->setAxisScale(0,0.0, maxBufferDepth);
|
||||
|
||||
Reference in New Issue
Block a user