Separated idle time collector.
This commit is contained in:
@@ -199,20 +199,20 @@ Controller::Controller(sc_module_name name) :
|
||||
else
|
||||
SC_REPORT_FATAL("Controller", "Selected refresh mode not supported!");
|
||||
|
||||
startBandwidthIdleCollector();
|
||||
idleTimeCollector.start();
|
||||
}
|
||||
|
||||
Controller::~Controller()
|
||||
{
|
||||
endBandwithIdleCollector();
|
||||
idleTimeCollector.end();
|
||||
|
||||
delete respQueue;
|
||||
for (auto it : refreshManagers)
|
||||
delete it;
|
||||
for (auto it : powerDownManagers)
|
||||
delete it;
|
||||
for (auto it : bankMachines)
|
||||
delete it;
|
||||
delete respQueue;
|
||||
delete cmdMux;
|
||||
delete scheduler;
|
||||
delete checker;
|
||||
@@ -406,7 +406,7 @@ void Controller::releasePayload()
|
||||
|
||||
totalNumberOfPayloads--;
|
||||
if (totalNumberOfPayloads == 0)
|
||||
startBandwidthIdleCollector();
|
||||
idleTimeCollector.start();
|
||||
}
|
||||
|
||||
void Controller::acquirePayload()
|
||||
@@ -417,7 +417,7 @@ void Controller::acquirePayload()
|
||||
Rank rank = DramExtension::getRank(payloadToAcquire);
|
||||
|
||||
if (totalNumberOfPayloads == 0)
|
||||
endBandwithIdleCollector();
|
||||
idleTimeCollector.end();
|
||||
totalNumberOfPayloads++;
|
||||
|
||||
if(ranksNumberOfPayloads[rank.ID()] == 0)
|
||||
@@ -448,23 +448,3 @@ void Controller::sendToDram(Command command, tlm_generic_payload *payload)
|
||||
|
||||
iSocket->nb_transport_fw(*payload, phase, delay);
|
||||
}
|
||||
|
||||
void Controller::startBandwidthIdleCollector()
|
||||
{
|
||||
if (!isIdle)
|
||||
{
|
||||
PRINTDEBUGMESSAGE(name(), "IDLE start");
|
||||
idleStart = sc_time_stamp();
|
||||
isIdle = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Controller::endBandwithIdleCollector()
|
||||
{
|
||||
if (isIdle)
|
||||
{
|
||||
PRINTDEBUGMESSAGE(name(), "IDLE end");
|
||||
idleTime += sc_time_stamp() - idleStart;
|
||||
isIdle = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,11 +77,6 @@ protected:
|
||||
private:
|
||||
unsigned totalNumberOfPayloads = 0;
|
||||
std::vector<unsigned> ranksNumberOfPayloads;
|
||||
tlm_generic_payload *payloadToAcquire = nullptr;
|
||||
sc_time timeToAcquire = sc_max_time();
|
||||
tlm_generic_payload *payloadToRelease = nullptr;
|
||||
sc_time timeToRelease = sc_max_time();
|
||||
std::queue<std::pair<sc_time, tlm_generic_payload *>> responseQueue;
|
||||
|
||||
MemSpec *memSpec;
|
||||
|
||||
@@ -94,17 +89,16 @@ private:
|
||||
std::vector<RefreshManagerIF *> refreshManagers;
|
||||
std::vector<PowerDownManagerIF *> powerDownManagers;
|
||||
|
||||
tlm_generic_payload *payloadToAcquire = nullptr;
|
||||
sc_time timeToAcquire = sc_max_time();
|
||||
tlm_generic_payload *payloadToRelease = nullptr;
|
||||
sc_time timeToRelease = sc_max_time();
|
||||
|
||||
void releasePayload();
|
||||
void acquirePayload();
|
||||
|
||||
void controllerMethod();
|
||||
sc_event beginReqEvent, endRespEvent, controllerEvent, dataResponseEvent;
|
||||
|
||||
// Bandwidth related
|
||||
sc_time idleStart;
|
||||
bool isIdle = false;
|
||||
void startBandwidthIdleCollector();
|
||||
void endBandwithIdleCollector();
|
||||
};
|
||||
|
||||
#endif // CONTROLLER_H
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
* Configuration::getInstance().memSpec->tCK;
|
||||
|
||||
double bandwidth = (activeTime / sc_time_stamp() * 100);
|
||||
double bandwidth_IDLE = ((activeTime) / (sc_time_stamp() - idleTime) * 100);
|
||||
double bandwidthWoIdle = ((activeTime) / (sc_time_stamp() - idleTimeCollector.getIdleTime()) * 100);
|
||||
|
||||
double maxBandwidth = (
|
||||
// fCK in Mhz e.g. 800 [MHz]:
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
<< std::endl;
|
||||
std::cout << name() << std::string(" AVG BW\\IDLE: ")
|
||||
<< std::fixed << std::setprecision(2)
|
||||
<< ((bandwidth_IDLE / 100) * maxBandwidth)
|
||||
<< " Gibit/s (" << bandwidth_IDLE << " %)"
|
||||
<< ((bandwidthWoIdle / 100) * maxBandwidth)
|
||||
<< " Gibit/s (" << bandwidthWoIdle << " %)"
|
||||
<< endl;
|
||||
std::cout << name() << std::string(" MAX BW: ")
|
||||
<< std::fixed << std::setprecision(2)
|
||||
@@ -75,7 +75,40 @@ protected:
|
||||
virtual tlm_sync_enum nb_transport_bw(tlm_generic_payload &, tlm_phase &, sc_time &) = 0;
|
||||
|
||||
// Bandwidth related
|
||||
sc_time idleTime = SC_ZERO_TIME;
|
||||
class IdleTimeCollector
|
||||
{
|
||||
public:
|
||||
void start()
|
||||
{
|
||||
if (!isIdle)
|
||||
{
|
||||
PRINTDEBUGMESSAGE("IdleTimeCollector", "IDLE start");
|
||||
idleStart = sc_time_stamp();
|
||||
isIdle = true;
|
||||
}
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
if (isIdle)
|
||||
{
|
||||
PRINTDEBUGMESSAGE("IdleTimeCollector", "IDLE end");
|
||||
idleTime += sc_time_stamp() - idleStart;
|
||||
isIdle = false;
|
||||
}
|
||||
}
|
||||
|
||||
sc_time getIdleTime()
|
||||
{
|
||||
return idleTime;
|
||||
}
|
||||
|
||||
private:
|
||||
bool isIdle = false;
|
||||
sc_time idleTime = SC_ZERO_TIME;
|
||||
sc_time idleStart;
|
||||
} idleTimeCollector;
|
||||
|
||||
uint64_t numberOfTransactionsServed = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user