mem-ruby: AbstractController unaddressed profiling
Adds support for profiling "unaddressed" transactions, which are associated with a unique ID rather than a memory address, to AbstractController. JIRA: https://gem5.atlassian.net/browse/GEM5-1097 Change-Id: Ib75f3f38dc4910acc2ad4f1c7bf88c9193568203 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57297 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Giacomo Travaglini
parent
920859e191
commit
7e84a14a26
@@ -228,23 +228,33 @@ class AbstractController : public ClockedObject, public Consumer
|
|||||||
|
|
||||||
// Tracks outstanding transactions for latency profiling
|
// Tracks outstanding transactions for latency profiling
|
||||||
struct TransMapPair { unsigned transaction; unsigned state; Tick time; };
|
struct TransMapPair { unsigned transaction; unsigned state; Tick time; };
|
||||||
std::unordered_map<Addr, TransMapPair> m_inTrans;
|
std::unordered_map<Addr, TransMapPair> m_inTransAddressed;
|
||||||
std::unordered_map<Addr, TransMapPair> m_outTrans;
|
std::unordered_map<Addr, TransMapPair> m_outTransAddressed;
|
||||||
|
|
||||||
|
std::unordered_map<Addr, TransMapPair> m_inTransUnaddressed;
|
||||||
|
std::unordered_map<Addr, TransMapPair> m_outTransUnaddressed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Profiles an event that initiates a protocol transactions for a specific
|
* Profiles an event that initiates a protocol transactions for a specific
|
||||||
* line (e.g. events triggered by incoming request messages).
|
* line (e.g. events triggered by incoming request messages).
|
||||||
* A histogram with the latency of the transactions is generated for
|
* A histogram with the latency of the transactions is generated for
|
||||||
* all combinations of trigger event, initial state, and final state.
|
* all combinations of trigger event, initial state, and final state.
|
||||||
|
* This function also supports "unaddressed" transactions,
|
||||||
|
* those not associated with an address in memory but
|
||||||
|
* instead associated with a unique ID.
|
||||||
*
|
*
|
||||||
* @param addr address of the line
|
* @param addr address of the line, or unique transaction ID
|
||||||
* @param type event that started the transaction
|
* @param type event that started the transaction
|
||||||
* @param initialState state of the line before the transaction
|
* @param initialState state of the line before the transaction
|
||||||
|
* @param isAddressed is addr a line address or a unique ID
|
||||||
*/
|
*/
|
||||||
template<typename EventType, typename StateType>
|
template<typename EventType, typename StateType>
|
||||||
void incomingTransactionStart(Addr addr,
|
void incomingTransactionStart(Addr addr,
|
||||||
EventType type, StateType initialState, bool retried)
|
EventType type, StateType initialState, bool retried,
|
||||||
|
bool isAddressed=true)
|
||||||
{
|
{
|
||||||
|
auto& m_inTrans =
|
||||||
|
isAddressed ? m_inTransAddressed : m_inTransUnaddressed;
|
||||||
assert(m_inTrans.find(addr) == m_inTrans.end());
|
assert(m_inTrans.find(addr) == m_inTrans.end());
|
||||||
m_inTrans[addr] = {type, initialState, curTick()};
|
m_inTrans[addr] = {type, initialState, curTick()};
|
||||||
if (retried)
|
if (retried)
|
||||||
@@ -253,13 +263,20 @@ class AbstractController : public ClockedObject, public Consumer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Profiles an event that ends a transaction.
|
* Profiles an event that ends a transaction.
|
||||||
|
* This function also supports "unaddressed" transactions,
|
||||||
|
* those not associated with an address in memory but
|
||||||
|
* instead associated with a unique ID.
|
||||||
*
|
*
|
||||||
* @param addr address of the line with a outstanding transaction
|
* @param addr address or unique ID with an outstanding transaction
|
||||||
* @param finalState state of the line after the transaction
|
* @param finalState state of the line after the transaction
|
||||||
|
* @param isAddressed is addr a line address or a unique ID
|
||||||
*/
|
*/
|
||||||
template<typename StateType>
|
template<typename StateType>
|
||||||
void incomingTransactionEnd(Addr addr, StateType finalState)
|
void incomingTransactionEnd(Addr addr, StateType finalState,
|
||||||
|
bool isAddressed=true)
|
||||||
{
|
{
|
||||||
|
auto& m_inTrans =
|
||||||
|
isAddressed ? m_inTransAddressed : m_inTransUnaddressed;
|
||||||
auto iter = m_inTrans.find(addr);
|
auto iter = m_inTrans.find(addr);
|
||||||
assert(iter != m_inTrans.end());
|
assert(iter != m_inTrans.end());
|
||||||
stats.inTransLatHist[iter->second.transaction]
|
stats.inTransLatHist[iter->second.transaction]
|
||||||
@@ -273,13 +290,20 @@ class AbstractController : public ClockedObject, public Consumer
|
|||||||
/**
|
/**
|
||||||
* Profiles an event that initiates a transaction in a peer controller
|
* Profiles an event that initiates a transaction in a peer controller
|
||||||
* (e.g. an event that sends a request message)
|
* (e.g. an event that sends a request message)
|
||||||
|
* This function also supports "unaddressed" transactions,
|
||||||
|
* those not associated with an address in memory but
|
||||||
|
* instead associated with a unique ID.
|
||||||
*
|
*
|
||||||
* @param addr address of the line
|
* @param addr address of the line or a unique transaction ID
|
||||||
* @param type event that started the transaction
|
* @param type event that started the transaction
|
||||||
|
* @param isAddressed is addr a line address or a unique ID
|
||||||
*/
|
*/
|
||||||
template<typename EventType>
|
template<typename EventType>
|
||||||
void outgoingTransactionStart(Addr addr, EventType type)
|
void outgoingTransactionStart(Addr addr, EventType type,
|
||||||
|
bool isAddressed=true)
|
||||||
{
|
{
|
||||||
|
auto& m_outTrans =
|
||||||
|
isAddressed ? m_outTransAddressed : m_outTransUnaddressed;
|
||||||
assert(m_outTrans.find(addr) == m_outTrans.end());
|
assert(m_outTrans.find(addr) == m_outTrans.end());
|
||||||
m_outTrans[addr] = {type, 0, curTick()};
|
m_outTrans[addr] = {type, 0, curTick()};
|
||||||
}
|
}
|
||||||
@@ -287,11 +311,18 @@ class AbstractController : public ClockedObject, public Consumer
|
|||||||
/**
|
/**
|
||||||
* Profiles the end of an outgoing transaction.
|
* Profiles the end of an outgoing transaction.
|
||||||
* (e.g. receiving the response for a requests)
|
* (e.g. receiving the response for a requests)
|
||||||
|
* This function also supports "unaddressed" transactions,
|
||||||
|
* those not associated with an address in memory but
|
||||||
|
* instead associated with a unique ID.
|
||||||
*
|
*
|
||||||
* @param addr address of the line with an outstanding transaction
|
* @param addr address of the line with an outstanding transaction
|
||||||
|
* @param isAddressed is addr a line address or a unique ID
|
||||||
*/
|
*/
|
||||||
void outgoingTransactionEnd(Addr addr, bool retried)
|
void outgoingTransactionEnd(Addr addr, bool retried,
|
||||||
|
bool isAddressed=true)
|
||||||
{
|
{
|
||||||
|
auto& m_outTrans =
|
||||||
|
isAddressed ? m_outTransAddressed : m_outTransUnaddressed;
|
||||||
auto iter = m_outTrans.find(addr);
|
auto iter = m_outTrans.find(addr);
|
||||||
assert(iter != m_outTrans.end());
|
assert(iter != m_outTrans.end());
|
||||||
stats.outTransLatHist[iter->second.transaction]->sample(
|
stats.outTransLatHist[iter->second.transaction]->sample(
|
||||||
|
|||||||
Reference in New Issue
Block a user