Started adding manual code for DDR3 time dependencies.
This commit is contained in:
@@ -99,11 +99,9 @@ add_executable(TraceAnalyzer
|
||||
businessObjects/pythoncaller.cpp
|
||||
businessObjects/tracetestresults.cpp
|
||||
presentation/tracemetrictreewidget.cpp
|
||||
businessObjects/phasedependenciestracker.cpp
|
||||
businessObjects/phases/phase.cpp
|
||||
businessObjects/phases/phasedependency.cpp
|
||||
businessObjects/phases/dependencyinfos.cpp
|
||||
businessObjects/dramTimeDependencies/timedependenciesIF.cpp
|
||||
presentation/tracedrawingproperties.cpp
|
||||
presentation/util/traceplotline.cpp
|
||||
presentation/util/traceplotlinecache.cpp
|
||||
@@ -119,6 +117,11 @@ add_executable(TraceAnalyzer
|
||||
businessObjects/dramTimeDependencies/dramtimedependencyfactory.cpp
|
||||
businessObjects/phasedependenciestracker.cpp
|
||||
|
||||
businessObjects/dramTimeDependencies/dramtimedependenciesIF.cpp
|
||||
businessObjects/dramTimeDependencies/DDR3TimeDependencies.cpp
|
||||
businessObjects/dramTimeDependencies/dramtimedependencyfactory.cpp
|
||||
businessObjects/phasedependenciestracker.cpp
|
||||
|
||||
selectmetrics.ui
|
||||
preferences.ui
|
||||
evaluationtool.ui
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
|
||||
#include "timedependenciesIF.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
DRAMTimeDependenciesIF::DRAMTimeDependenciesIF(const TraceDB& tdb) {
|
||||
mGetMemspec(tdb);
|
||||
|
||||
}
|
||||
|
||||
DependencyMap
|
||||
DRAMTimeDependenciesIF::getDependencies(std::vector<QString>& dependencyFilter) const {
|
||||
DependencyMap dependenciesMap;
|
||||
|
||||
std::sort(
|
||||
dependencyFilter.begin(),
|
||||
dependencyFilter.end(),
|
||||
QStringsComparator::compareQStrings
|
||||
);
|
||||
|
||||
dependenciesMap = mSpecializedGetDependencies();
|
||||
|
||||
mFilterDependencyMap(dependenciesMap, dependencyFilter);
|
||||
|
||||
auto it = dependenciesMap.begin();
|
||||
while (it != dependenciesMap.end()) {
|
||||
mFilterDependencyList(it->second.dependencies, dependencyFilter);
|
||||
it->second.maxTime = mFindVectorMaximum(it->second.dependencies);
|
||||
}
|
||||
|
||||
return dependenciesMap;
|
||||
}
|
||||
|
||||
void DRAMTimeDependenciesIF::mGetMemspec(const TraceDB& tdb) {
|
||||
QSqlDatabase db = tdb.getDatabase();
|
||||
QString query = "SELECT Memspec FROM GeneralInfo";
|
||||
QSqlQuery sqlQuery = db.exec(query);
|
||||
|
||||
sqlQuery.next();
|
||||
QString memSpecJson = sqlQuery.value(0).toString();
|
||||
sqlQuery.finish();
|
||||
|
||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(memSpecJson.toUtf8());
|
||||
mMemspecJson = jsonDocument.object()["memspec"].toObject();
|
||||
|
||||
}
|
||||
|
||||
void DRAMTimeDependenciesIF::mFilterDependencyList(std::vector<TimeDependency>& dependencyList, const std::vector<QString>& dependencyFilter) const {
|
||||
std::vector<TimeDependency> newDepList(dependencyList.size());
|
||||
|
||||
std::copy_if(
|
||||
dependencyList.begin(),
|
||||
dependencyList.end(),
|
||||
newDepList.begin(),
|
||||
[ dependencyFilter ](const TimeDependency& dep) {
|
||||
auto it = std::lower_bound(
|
||||
dependencyFilter.begin(),
|
||||
dependencyFilter.end(),
|
||||
dep.phaseDep,
|
||||
QStringsComparator::compareQStrings
|
||||
);
|
||||
|
||||
if (it != dependencyFilter.end() && *it == dep.phaseDep) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
newDepList.shrink_to_fit();
|
||||
|
||||
dependencyList = newDepList;
|
||||
|
||||
}
|
||||
|
||||
void DRAMTimeDependenciesIF::mFilterDependencyMap(DependencyMap& dependencyMap, const std::vector<QString>& dependencyFilter) const {
|
||||
if (!dependencyMap.empty()) {
|
||||
|
||||
auto itFilter = dependencyFilter.begin();
|
||||
auto itFilterLast = std::lower_bound(
|
||||
dependencyFilter.begin(),
|
||||
dependencyFilter.end(),
|
||||
dependencyMap.rbegin()->first
|
||||
);
|
||||
|
||||
auto itDependencyMap = dependencyMap.begin();
|
||||
|
||||
while (true) {
|
||||
|
||||
auto pair = std::mismatch(
|
||||
itFilter,
|
||||
itFilterLast,
|
||||
itDependencyMap,
|
||||
[](const QString& cmd, const std::pair<QString, PhaseTimeDependencies>& vpair) {
|
||||
return cmd == vpair.first;
|
||||
}
|
||||
);
|
||||
|
||||
if (pair.first == dependencyFilter.end() || pair.second == dependencyMap.end()) {
|
||||
dependencyMap.erase(pair.second, dependencyMap.end());
|
||||
break;
|
||||
|
||||
} else if (pair.first->compare(pair.second->first) < 0) {
|
||||
++(pair.first);
|
||||
|
||||
} else {
|
||||
pair.second = dependencyMap.erase(pair.second);
|
||||
|
||||
}
|
||||
|
||||
itFilter = pair.first;
|
||||
itDependencyMap = pair.second;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t DRAMTimeDependenciesIF::mFindVectorMaximum(const std::vector<TimeDependency>& dependencyList) const {
|
||||
auto maxElement = std::max_element(
|
||||
dependencyList.begin(),
|
||||
dependencyList.end(),
|
||||
[](const TimeDependency& dep1, const TimeDependency& dep2) {
|
||||
return dep1.timeValue < dep2.timeValue;
|
||||
}
|
||||
);
|
||||
|
||||
if (maxElement == dependencyList.end()) return 0;
|
||||
|
||||
return maxElement->timeValue;
|
||||
}
|
||||
|
||||
bool QStringsComparator::operator()(const QString& s1, const QString& s2) {
|
||||
return s1.compare(s2) < 0;
|
||||
}
|
||||
|
||||
bool QStringsComparator::compareQStrings(const QString& s1, const QString& s2) {
|
||||
return s1.compare(s2) < 0;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "data/tracedb.h"
|
||||
#include "businessObjects/phases/phasedependency.h"
|
||||
|
||||
struct TimeDependency {
|
||||
size_t timeValue;
|
||||
QString phaseDep;
|
||||
DependencyType depType;
|
||||
QString timeDepName;
|
||||
};
|
||||
|
||||
struct PhaseTimeDependencies {
|
||||
QString phaseName;
|
||||
std::vector<TimeDependency> dependencies;
|
||||
size_t maxTime;
|
||||
};
|
||||
|
||||
|
||||
struct QStringsComparator {
|
||||
bool operator()(const QString& s1, const QString& s2);
|
||||
static bool compareQStrings(const QString& s1, const QString& s2);
|
||||
};
|
||||
|
||||
typedef std::map<QString, PhaseTimeDependencies, QStringsComparator> DependencyMap;
|
||||
|
||||
class DRAMTimeDependenciesIF {
|
||||
public:
|
||||
DRAMTimeDependenciesIF(const TraceDB& tdb);
|
||||
virtual ~DRAMTimeDependenciesIF() = default;
|
||||
|
||||
DependencyMap getDependencies(std::vector<QString>& dependencyFilter) const;
|
||||
|
||||
protected:
|
||||
void mFilterDependencyList(std::vector<TimeDependency>& dependencyList, const std::vector<QString>& dependencyFilter) const;
|
||||
void mFilterDependencyMap(DependencyMap& dependencyMap, const std::vector<QString>& dependencyFilter) const;
|
||||
size_t mFindVectorMaximum(const std::vector<TimeDependency>& dependencyList) const;
|
||||
|
||||
protected:
|
||||
QJsonObject mMemspecJson;
|
||||
|
||||
// To be implemented
|
||||
protected:
|
||||
virtual void mInitializeValues() = 0;
|
||||
virtual DependencyMap mSpecializedGetDependencies() const = 0;
|
||||
|
||||
private:
|
||||
void mGetMemspec(const TraceDB& tdb);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user