Started refactoring for dependency calculation skipping.
This commit is contained in:
@@ -114,6 +114,7 @@ add_executable(TraceAnalyzer
|
||||
|
||||
businessObjects/dramTimeDependencies/activatewindowpoolcontroller.cpp
|
||||
businessObjects/dramTimeDependencies/dramtimedependenciesIF.cpp
|
||||
businessObjects/dramTimeDependencies/dbEntries/DDR3dbphaseentry.cpp
|
||||
businessObjects/dramTimeDependencies/DDR3TimeDependencies.cpp
|
||||
businessObjects/dramTimeDependencies/dramtimedependencyfactory.cpp
|
||||
businessObjects/dramTimeDependencies/phasedependenciestracker.cpp
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
|
||||
#include "commonstructures.h"
|
||||
|
||||
// TODO
|
||||
class ActivateWindowPoolController {
|
||||
public:
|
||||
ActivateWindowPoolController(const std::map<QString, uint, QStringsComparator>& poolSizes);
|
||||
|
||||
@@ -45,22 +45,8 @@
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "businessObjects/phases/phasedependency.h"
|
||||
|
||||
class TimeDependency {
|
||||
public:
|
||||
TimeDependency() = default;
|
||||
TimeDependency(size_t timeValue, QString phaseDep, DependencyType depType,
|
||||
QString timeDepName, bool considerIntraRank = false)
|
||||
: timeValue{timeValue}, phaseDep{phaseDep}, depType{depType},
|
||||
timeDepName{timeDepName}, considerIntraRank{considerIntraRank} {}
|
||||
|
||||
size_t timeValue;
|
||||
QString phaseDep;
|
||||
DependencyType depType;
|
||||
QString timeDepName;
|
||||
bool considerIntraRank = false; // Used only for InterRank skip check in PhaseDependenciesTracker::mCalculateDependencies
|
||||
|
||||
};
|
||||
#include "timedependency.h"
|
||||
#include "businessObjects/dramTimeDependencies/dbEntries/includes.h"
|
||||
|
||||
struct PhaseTimeDependencies {
|
||||
explicit PhaseTimeDependencies(std::initializer_list<TimeDependency> d) : dependencies(d) {}
|
||||
@@ -76,17 +62,6 @@ struct QStringsComparator {
|
||||
|
||||
typedef std::map<QString, PhaseTimeDependencies, QStringsComparator> DependencyMap;
|
||||
|
||||
|
||||
struct DBPhaseEntry {
|
||||
size_t id;
|
||||
QString phaseName;
|
||||
size_t phaseBegin;
|
||||
size_t phaseEnd;
|
||||
size_t transact;
|
||||
size_t tBank;
|
||||
size_t tRank;
|
||||
};
|
||||
|
||||
struct DBDependencyEntry {
|
||||
size_t delayedPhaseID;
|
||||
QString delayedPhaseName;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#include "DDR3dbphaseentry.h"
|
||||
|
||||
DDR3DBPhaseEntry::DDR3DBPhaseEntry(const QSqlQuery& query) {
|
||||
id = query.value(0).toLongLong();
|
||||
phaseName = query.value(1).toString();
|
||||
phaseBegin = query.value(2).toLongLong();
|
||||
phaseEnd = query.value(3).toLongLong();
|
||||
transact = query.value(4).toLongLong();
|
||||
tBank = query.value(5).toLongLong();
|
||||
// tBankgroup = query.value(6).toLongLong();
|
||||
tRank = query.value(7).toLongLong();
|
||||
}
|
||||
|
||||
bool DDR3DBPhaseEntry::potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryIF> otherPhase) const {
|
||||
auto other = std::dynamic_pointer_cast<DDR3DBPhaseEntry>(otherPhase);
|
||||
if (!other) return false;
|
||||
|
||||
bool const skipOnIntraBankAndDifferentBanks = {
|
||||
dep.depType == DependencyType::IntraBank
|
||||
&& tBank != other->tBank
|
||||
};
|
||||
bool const skipOnIntraRankAndDifferentRanks = {
|
||||
dep.depType == DependencyType::IntraRank
|
||||
&& tRank != other->tRank
|
||||
};
|
||||
bool const skipOnInterRankAndSameRank = {
|
||||
dep.depType == DependencyType::InterRank
|
||||
&& tRank == other->tRank
|
||||
};
|
||||
|
||||
return !(skipOnIntraBankAndDifferentBanks || skipOnIntraRankAndDifferentRanks || skipOnInterRankAndSameRank);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dbphaseentryIF.h"
|
||||
|
||||
class DDR3DBPhaseEntry : public DBPhaseEntryIF {
|
||||
public:
|
||||
DDR3DBPhaseEntry(const QSqlQuery&);
|
||||
|
||||
// size_t tBankgroup;
|
||||
size_t tRank;
|
||||
|
||||
bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryIF> otherPhase) const override;
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "businessObjects/phases/phasedependency.h"
|
||||
#include "businessObjects/dramTimeDependencies/timedependency.h"
|
||||
|
||||
class DBPhaseEntryIF {
|
||||
public:
|
||||
DBPhaseEntryIF() = default;
|
||||
~DBPhaseEntryIF() = default;
|
||||
|
||||
virtual bool potentialDependency(const TimeDependency& dep, const std::shared_ptr<DBPhaseEntryIF> otherPhase) const { return false; }
|
||||
|
||||
size_t id;
|
||||
QString phaseName;
|
||||
size_t phaseBegin;
|
||||
size_t phaseEnd;
|
||||
size_t transact;
|
||||
size_t tBank;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dbphaseentryIF.h"
|
||||
#include "DDR3dbphaseentry.h"
|
||||
@@ -120,11 +120,11 @@ void PhaseDependenciesTracker::mInsertIntoTable(TraceDB& tdb, const std::vector<
|
||||
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<DBPhaseEntry>>
|
||||
const std::vector<std::shared_ptr<DBPhaseEntryIF>>
|
||||
PhaseDependenciesTracker::mGetFilteredPhases(TraceDB& tdb, const std::vector<QString>& commands) {
|
||||
std::vector<std::shared_ptr<DBPhaseEntry>> phases;
|
||||
std::vector<std::shared_ptr<DBPhaseEntryIF>> phases;
|
||||
|
||||
QString queryStr = "SELECT Phases.*, Transactions.TBank, Transactions.TRank "
|
||||
QString queryStr = "SELECT Phases.*, Transactions.TBank, Transactions.TBankgroup, Transactions.TRank "
|
||||
" FROM Phases "
|
||||
" INNER JOIN Transactions "
|
||||
" ON Phases.Transact=Transactions.ID "
|
||||
@@ -159,16 +159,9 @@ PhaseDependenciesTracker::mGetFilteredPhases(TraceDB& tdb, const std::vector<QSt
|
||||
|
||||
size_t rowIt = 0;
|
||||
do {
|
||||
DBPhaseEntry phase;
|
||||
phase.id = query.value(0).toLongLong();
|
||||
phase.phaseName = query.value(1).toString();
|
||||
phase.phaseBegin = query.value(2).toLongLong();
|
||||
phase.phaseEnd = query.value(3).toLongLong();
|
||||
phase.transact = query.value(4).toLongLong();
|
||||
phase.tBank = query.value(5).toLongLong();
|
||||
phase.tRank = query.value(6).toLongLong();
|
||||
// TODO factory method
|
||||
phases[rowIt] = std::make_shared<DDR3DBPhaseEntry>(query);
|
||||
|
||||
phases[rowIt] = std::make_shared<DBPhaseEntry>(phase);
|
||||
++rowIt;
|
||||
} while (query.next());
|
||||
|
||||
@@ -182,7 +175,7 @@ PhaseDependenciesTracker::mGetFilteredPhases(TraceDB& tdb, const std::vector<QSt
|
||||
}
|
||||
|
||||
const std::vector<DBDependencyEntry>
|
||||
PhaseDependenciesTracker::mCalculateDependencies(const TraceDB& tdb, const std::vector<std::shared_ptr<DBPhaseEntry>>& phases, std::vector<QString>& commands) {
|
||||
PhaseDependenciesTracker::mCalculateDependencies(const TraceDB& tdb, const std::vector<std::shared_ptr<DBPhaseEntryIF>>& phases, std::vector<QString>& commands) {
|
||||
std::vector<DBDependencyEntry> entries;
|
||||
entries.reserve((size_t) (0.4 * phases.size()));
|
||||
|
||||
@@ -198,8 +191,6 @@ PhaseDependenciesTracker::mCalculateDependencies(const TraceDB& tdb, const std::
|
||||
|
||||
// Auxiliary variables
|
||||
const auto& phase = phases[i];
|
||||
const size_t cmdBank = phase->tBank;
|
||||
const size_t cmdRank = phase->tRank;
|
||||
|
||||
// Get time dependency descriptions for the current phase
|
||||
const auto& deps = deviceDependencies.at(phase->phaseName);
|
||||
@@ -219,21 +210,7 @@ PhaseDependenciesTracker::mCalculateDependencies(const TraceDB& tdb, const std::
|
||||
int poolSubstrPos = dep.phaseDep.indexOf("_POOL", 3);
|
||||
if (poolSubstrPos == -1 && dep.phaseDep != otherPhase->phaseName) continue;
|
||||
|
||||
bool const skipOnIntraBankAndDifferentBanks = {
|
||||
dep.depType == DependencyType::IntraBank
|
||||
&& cmdBank != otherPhase->tBank
|
||||
};
|
||||
bool const skipOnIntraRankAndDifferentRanks = {
|
||||
dep.depType == DependencyType::IntraRank
|
||||
&& cmdRank != otherPhase->tRank
|
||||
};
|
||||
bool const skipOnInterRankAndSameRank = {
|
||||
dep.depType == DependencyType::InterRank
|
||||
&& cmdRank == otherPhase->tRank
|
||||
&& !dep.considerIntraRank
|
||||
};
|
||||
|
||||
if (skipOnIntraBankAndDifferentBanks || skipOnIntraRankAndDifferentRanks || skipOnInterRankAndSameRank) {
|
||||
if (!phase->potentialDependency(dep, otherPhase)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ private:
|
||||
static void mCreateTable(TraceDB& tdb);
|
||||
static void mInsertIntoTable(TraceDB& tdb, const std::vector<DBDependencyEntry>& entries);
|
||||
|
||||
static const std::vector<std::shared_ptr<DBPhaseEntry>> mGetFilteredPhases(TraceDB& tdb, const std::vector<QString>& commands);
|
||||
static const std::vector<DBDependencyEntry> mCalculateDependencies(const TraceDB& tdb, const std::vector<std::shared_ptr<DBPhaseEntry>>& phases, std::vector<QString>& commands);
|
||||
static const std::vector<std::shared_ptr<DBPhaseEntryIF>> mGetFilteredPhases(TraceDB& tdb, const std::vector<QString>& commands);
|
||||
static const std::vector<DBDependencyEntry> mCalculateDependencies(const TraceDB& tdb, const std::vector<std::shared_ptr<DBPhaseEntryIF>>& phases, std::vector<QString>& commands);
|
||||
|
||||
static QSqlQuery mExecuteQuery(TraceDB& tdb, const QString queryStr);
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "businessObjects/phases/phasedependency.h"
|
||||
|
||||
class TimeDependency {
|
||||
public:
|
||||
TimeDependency() = default;
|
||||
TimeDependency(size_t timeValue, QString phaseDep, DependencyType depType,
|
||||
QString timeDepName, bool considerIntraRank = false)
|
||||
: timeValue{timeValue}, phaseDep{phaseDep}, depType{depType},
|
||||
timeDepName{timeDepName}, considerIntraRank{considerIntraRank} {}
|
||||
|
||||
size_t timeValue;
|
||||
QString phaseDep;
|
||||
DependencyType depType;
|
||||
QString timeDepName;
|
||||
bool considerIntraRank = false; // Used only for InterRank skip check in PhaseDependenciesTracker::mCalculateDependencies
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user