OpenASIP
2.0
|
#include <ExecutionTrace.hh>
Public Types | |
enum | ProcedureEntryType { PT_ENTRY = 0, PT_EXIT = 1 } |
a type for storing procedure entry type (entry/exit) More... | |
typedef std::string | AddressSpaceID |
a type for storing address space identifiers More... | |
typedef std::string | BusID |
a type for storing bus identifiers More... | |
typedef std::string | SocketID |
a type for storing socket identifiers More... | |
typedef std::string | SegmentID |
a type for storing bus segment identifiers More... | |
typedef std::string | FunctionUnitID |
a type for storing function unit identifiers More... | |
typedef std::string | OperationID |
a type for storing operation identifiers More... | |
typedef std::string | RegisterFileID |
a type for storing register file identifiers More... | |
typedef int | RegisterID |
a type for storing register ids More... | |
typedef unsigned int | MemoryAddress |
a type for storing memory addresses More... | |
typedef SimValue | MAU |
a type for storing data of size of the minimum addressable unit More... | |
typedef std::size_t | RegisterAccessCount |
a type for register access counts More... | |
typedef ClockCycleCount | OperationTriggerCount |
a type for operation trigger counts More... | |
typedef boost::tuple< RegisterAccessCount, RegisterAccessCount, ClockCycleCount > | ConcurrentRFAccessCount |
type to be used as a key for storing concurrent RF access info More... | |
typedef std::list< ConcurrentRFAccessCount > | ConcurrentRFAccessCountList |
type to be used for a list of concurrent RF accesses More... | |
typedef boost::tuple< OperationID, OperationTriggerCount > | FUOperationTriggerCount |
type to be used as a key for storing function unit operation execution counts More... | |
typedef std::list< FUOperationTriggerCount > | FUOperationTriggerCountList |
type to be used for lists of function operation execution counts More... | |
Static Public Member Functions | |
static ExecutionTrace * | open (const std::string &fileName) |
Protected Member Functions | |
ExecutionTrace (const std::string &fileName, bool readOnly) | |
void | open () |
Private Member Functions | |
void | initialize () |
Private Attributes | |
const std::string & | fileName_ |
Filename of the trace database (sqlite file). More... | |
std::fstream | callTrace_ |
The call trace file. More... | |
std::fstream | instructionProfile_ |
The instruction profile file. More... | |
bool | readOnly_ |
Is the database access mode read-only? More... | |
RelationalDB * | db_ |
Handle to the sqlite trace database. More... | |
RelationalDBConnection * | dbConnection_ |
Handle to the database connection;. More... | |
InstructionExecution * | instructionExecution_ |
Handle object for the queries of instruction executions. More... | |
The main class of the Execution Trace Database (TraceDB).
Access to the execution trace database happens through the interface of this class.
Definition at line 56 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::AddressSpaceID |
a type for storing address space identifiers
Definition at line 60 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::BusID |
a type for storing bus identifiers
Definition at line 63 of file ExecutionTrace.hh.
typedef boost::tuple< RegisterAccessCount, RegisterAccessCount, ClockCycleCount> ExecutionTrace::ConcurrentRFAccessCount |
type to be used as a key for storing concurrent RF access info
Definition at line 105 of file ExecutionTrace.hh.
typedef std::list<ConcurrentRFAccessCount> ExecutionTrace::ConcurrentRFAccessCountList |
type to be used for a list of concurrent RF accesses
Definition at line 108 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::FunctionUnitID |
a type for storing function unit identifiers
Definition at line 72 of file ExecutionTrace.hh.
typedef boost::tuple<OperationID, OperationTriggerCount> ExecutionTrace::FUOperationTriggerCount |
type to be used as a key for storing function unit operation execution counts
Definition at line 113 of file ExecutionTrace.hh.
typedef std::list<FUOperationTriggerCount> ExecutionTrace::FUOperationTriggerCountList |
type to be used for lists of function operation execution counts
Definition at line 116 of file ExecutionTrace.hh.
typedef SimValue ExecutionTrace::MAU |
a type for storing data of size of the minimum addressable unit
Definition at line 87 of file ExecutionTrace.hh.
typedef unsigned int ExecutionTrace::MemoryAddress |
a type for storing memory addresses
Definition at line 84 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::OperationID |
a type for storing operation identifiers
Definition at line 75 of file ExecutionTrace.hh.
a type for operation trigger counts
Definition at line 93 of file ExecutionTrace.hh.
typedef std::size_t ExecutionTrace::RegisterAccessCount |
a type for register access counts
Definition at line 90 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::RegisterFileID |
a type for storing register file identifiers
Definition at line 78 of file ExecutionTrace.hh.
typedef int ExecutionTrace::RegisterID |
a type for storing register ids
Definition at line 81 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::SegmentID |
a type for storing bus segment identifiers
Definition at line 69 of file ExecutionTrace.hh.
typedef std::string ExecutionTrace::SocketID |
a type for storing socket identifiers
Definition at line 66 of file ExecutionTrace.hh.
a type for storing procedure entry type (entry/exit)
Enumerator | |
---|---|
PT_ENTRY | procedure entry |
PT_EXIT | procedure exit |
Definition at line 96 of file ExecutionTrace.hh.
|
virtual |
Destructor.
Closes the database and frees the resources connected to it. Commits the transaction so updates are written to disk.
Definition at line 202 of file ExecutionTrace.cc.
References __func__, assert, callTrace_, RelationalDB::close(), RelationalDBConnection::commit(), db_, dbConnection_, debugLog, Exception::errorMessage(), instructionExecution_, instructionProfile_, and Application::writeToErrorLog().
|
protected |
Constructor.
fileName | Filename used for accessing the database. |
readOnly | Is the database read-only? |
Definition at line 180 of file ExecutionTrace.cc.
Referenced by open().
void ExecutionTrace::addBasicBlockStart | ( | ClockCycleCount | cycle, |
InstructionAddress | address | ||
) |
void ExecutionTrace::addBusActivity | ( | ClockCycleCount | cycle, |
const BusID & | busId, | ||
const SegmentID & | segmentId, | ||
bool | squash, | ||
const SimValue & | data = NullSimValue::instance() |
||
) |
Adds a new bus activity record to the database.
cycle | The clock cycle in which the bus activity happened. |
busId | The name of the bus. |
segmentId | The name of the segment in the bus. |
squash | Whether the transfer was squashed or not. |
data | The data transferred. |
IOException | In case an error in adding the data happened. |
Definition at line 391 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, SimValue::doubleWordValue(), Exception::errorMessage(), NullSimValue::instance(), Conversion::toString(), SimValue::uIntWordValue(), and RelationalDBConnection::updateQuery().
void ExecutionTrace::addBusWriteCount | ( | BusID | bus, |
ClockCycleCount | count | ||
) |
Adds a bus write count statistics to the database.
This stats tells in how many clock cycles was a bus used (transported data through).
socket | The name of the bus. |
count | The count of writes/uses. |
IOException | In case an error in adding the data happened. |
Definition at line 688 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, Exception::errorMessage(), Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
void ExecutionTrace::addConcurrentRegisterFileAccessCount | ( | RegisterFileID | registerFile, |
RegisterAccessCount | reads, | ||
RegisterAccessCount | writes, | ||
ClockCycleCount | count | ||
) |
Adds a concurrent register file access statistics to the database.
Statistics tells how many times a type of read/write count combination access happened. That is, how many times the given register file was read and written the given times simultaneously.
registerFile | The name of the register file. |
reads | Count of simultaneous reads. |
writes | Count of simultaneous writes. |
count | The count of this type of accesses. |
IOException | In case an error in adding the data happened. |
Definition at line 440 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, Exception::errorMessage(), Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
void ExecutionTrace::addFunctionUnitOperationTriggerCount | ( | FunctionUnitID | functionUnit, |
OperationID | operation, | ||
OperationTriggerCount | count | ||
) |
Adds a function unit operation execution statistics to the database.
Statistics tells how many times an operation was executed in an function unit.
functionUnit | The name of the function unit. |
operation | The name of the operation. |
count | The count of executions. |
IOException | In case an error in adding the data happened. |
Definition at line 546 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, Exception::errorMessage(), Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
void ExecutionTrace::addInstructionExecution | ( | ClockCycleCount | cycle, |
InstructionAddress | address | ||
) |
Adds a new instruction execution record to the database.
cycle | The clock cycle on which the instruction execution happened. |
address | The address of the executed instruction. |
IOException | In case an error in adding the data happened. |
Definition at line 279 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, Exception::errorMessage(), and RelationalDBConnection::updateQuery().
Referenced by ExecutionTracker::handleEvent().
void ExecutionTrace::addInstructionExecutionCount | ( | InstructionAddress | address, |
ClockCycleCount | count | ||
) |
Adds a new instruction execution count record to the database.
address | The address of the executed instruction. |
count | The count of clock cycles during which execution of the instruction happened. |
IOException | In case an error in adding the data happened. |
Definition at line 304 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, Exception::errorMessage(), instructionProfile_, Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
void ExecutionTrace::addLockedCycle | ( | ClockCycleCount | cycle | ) |
void ExecutionTrace::addMemoryAccess | ( | ClockCycleCount | cycle, |
const AddressSpaceID & | addressSpace, | ||
MemoryAddress | address, | ||
bool | write, | ||
std::size_t | size, | ||
const std::vector< MAU > * | data = NULL |
||
) |
void ExecutionTrace::addProcedureAddressRange | ( | InstructionAddress | firstAddress, |
InstructionAddress | lastAddress, | ||
const std::string & | procedureName | ||
) |
Adds a procedure address range entry to the database.
An entry in this table tells the range of instruction addresses belonging to a procedure.
firstAddress | The starting address of the procedure. |
lastAddress | The ending address of the procedure. |
name | The name of the procedure. |
IOException | In case an error in adding the data happened. |
Definition at line 335 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, Exception::errorMessage(), Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
void ExecutionTrace::addProcedureEntry | ( | ClockCycleCount | cycle, |
InstructionAddress | address | ||
) |
void ExecutionTrace::addProcedureExit | ( | ClockCycleCount | cycle, |
InstructionAddress | address | ||
) |
void ExecutionTrace::addProcedureTransfer | ( | ClockCycleCount | cycle, |
InstructionAddress | address, | ||
InstructionAddress | sourceAddress, | ||
ProcedureEntryType | type | ||
) |
Adds a procedure transfer tracking data entry.
cycle | The clock cycle in which the transfer occured. |
address | The instruction address to which the execution changed. |
callAddress | The address of the call. |
type | Type of the transfer. |
Definition at line 575 of file ExecutionTrace.cc.
References callTrace_.
Referenced by ProcedureTransferTracker::addProcedureTransfer().
void ExecutionTrace::addRegisterAccessCount | ( | RegisterFileID | registerFile, |
RegisterID | registerIndex, | ||
ClockCycleCount | reads, | ||
ClockCycleCount | writes | ||
) |
Adds a register access statistics to the database.
Statistics tells how many times a register was read and written during simulation.
registerFile | The name of the register file. |
registerIndex | The index of the register. |
reads | Count of reads. |
writes | Count of writes. |
IOException | In case an error in adding the data happened. |
Definition at line 475 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, Exception::errorMessage(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
void ExecutionTrace::addSocketWriteCount | ( | SocketID | socket, |
ClockCycleCount | count | ||
) |
Adds a socket write count statistics to the database.
This stats tells in how many clock cycles was a socket used (transported data through).
socket | The name of the socket. |
count | The count of writes/uses. |
IOException | In case an error in adding the data happened. |
Definition at line 631 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, Exception::errorMessage(), Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
ClockCycleCount ExecutionTrace::busWriteCount | ( | BusID | bus | ) | const |
Returns the count of clock cycles in which a bus was written to.
In case no data was found for the given bus in DB, returns 0.
bus | The name of the bus. |
Definition at line 713 of file ExecutionTrace.cc.
References RelationalDBQueryResult::data(), dbConnection_, RelationalDBQueryResult::hasNext(), RelationalDBQueryResult::next(), and RelationalDBConnection::query().
Referenced by DefaultICDecoderEstimator::estimateICEnergy().
ExecutionTrace::FUOperationTriggerCountList * ExecutionTrace::functionUnitOperationTriggerCounts | ( | FunctionUnitID | functionUnit | ) | const |
Returns the list of operation access counts for wanted function unit.
functionUnit | The function unit for which the stats are needed. |
IOException | If an I/O error occurs. |
Definition at line 591 of file ExecutionTrace.cc.
References __func__, assert, RelationalDBQueryResult::data(), dbConnection_, Exception::errorMessage(), RelationalDBQueryResult::hasNext(), RelationalDBQueryResult::next(), and RelationalDBConnection::query().
Referenced by StrictMatchFUEstimator::estimateEnergy(), and InterpolatingFUEstimator::estimateEnergy().
|
private |
Initializes a new trace database.
IOException | If an I/O error occured. |
Definition at line 243 of file ExecutionTrace.cc.
References __func__, assert, CQ_BUS_ACTIVITY, CQ_BUS_WRITE_COUNTS, CQ_CONCURRENT_REGISTER_FILE_ACCESS, CQ_DATABASE_INFO, CQ_FU_OPERATION_TRIGGERS, CQ_INSTRUCTION_EXECUTION, CQ_PROCEDURE_ADDRESS_RANGE, CQ_REGISTER_ACCESS, CQ_SOCKET_WRITE_COUNTS, CQ_TOTALS, DB_VERSION, dbConnection_, RelationalDBConnection::DDLQuery(), debugLog, Exception::errorMessage(), and RelationalDBConnection::updateQuery().
Referenced by open().
InstructionExecution & ExecutionTrace::instructionExecutions | ( | ) |
Queries database for instruction execution entries.
IOException | If an I/O error occurs. |
Definition at line 363 of file ExecutionTrace.cc.
References __func__, dbConnection_, Exception::errorMessage(), instructionExecution_, and RelationalDBConnection::query().
Referenced by open().
|
protected |
Initializes the trace files.
For the traceDB sqlite file, starts a new transaction. Transaction is committed in destructor. This consumes lots of memory but should reduce I/O to the minimum.
Definition at line 169 of file ExecutionTrace.cc.
References RelationalDBConnection::beginTransaction(), RelationalDB::connect(), db_, dbConnection_, and fileName_.
Referenced by SimulatorFrontend::initializeTracing(), and loadInputs().
|
static |
Creates a new execution trace database.
If the database file cannot be found, creates a new database file and initializes it. Some of the bigger traces are written to separate ascii files to speed up trace generation.
The filenames are formed as follows:
fileName The main traceDB relational database file, always created (e.g. foobar.tpef.1.trace). fileName.calls The call trace, produced with 'procedure_transfer_tracking' setting of ttasim (e.g. foobar.tpef.1.trace.calls). fileName.profile The instruction execution counts, produced with 'profile_data_saving' setting of ttasim (e.g. foobar.tpef.1.trace.profile).
fileName | Full path to the traceDB file to be opened. |
IOException | If there was a problem opening the database, for example, if the file cannot be found and a new file cannot be created. |
Definition at line 138 of file ExecutionTrace.cc.
References __func__, Exception::errorMessage(), ExecutionTrace(), FileSystem::fileExists(), FileSystem::fileIsWritable(), initialize(), instructionExecutions(), and open().
Referenced by open().
ExecutionTrace::ConcurrentRFAccessCountList * ExecutionTrace::registerFileAccessCounts | ( | RegisterFileID | registerFile | ) | const |
Returns the list of different concurrent register file access combinations and counts how many times those were encountered while simulating the program.
registerFile | The register file for which the stats are needed. |
IOException | If an I/O error occurs. |
Definition at line 505 of file ExecutionTrace.cc.
References __func__, assert, RelationalDBQueryResult::data(), dbConnection_, Exception::errorMessage(), RelationalDBQueryResult::hasNext(), RelationalDBQueryResult::next(), and RelationalDBConnection::query().
Referenced by StrictMatchRFEstimator::estimateEnergy(), and InterpolatingRFEstimator::estimateEnergy().
void ExecutionTrace::setSimulatedCycleCount | ( | ClockCycleCount | count | ) |
Sets the total count of simulated clock cycles.
count | The count of cycles. |
IOException | In case an error in adding the data happened. |
Definition at line 741 of file ExecutionTrace.cc.
References __func__, assert, dbConnection_, debugLog, Exception::errorMessage(), Conversion::toString(), and RelationalDBConnection::updateQuery().
Referenced by SimulatorFrontend::finishSimulation().
ClockCycleCount ExecutionTrace::simulatedCycleCount | ( | ) | const |
Gets the total count of simulated clock cycles.
IOException | In case an error in getting the data happened. |
Definition at line 764 of file ExecutionTrace.cc.
References __func__, RelationalDBQueryResult::data(), dbConnection_, Exception::errorMessage(), RelationalDBQueryResult::hasNext(), RelationalDBQueryResult::next(), and RelationalDBConnection::query().
Referenced by StrictMatchFUEstimator::estimateEnergy(), StrictMatchRFEstimator::estimateEnergy(), InterpolatingFUEstimator::estimateEnergy(), InterpolatingRFEstimator::estimateEnergy(), and DefaultICDecoderEstimator::estimateICEnergy().
ClockCycleCount ExecutionTrace::socketWriteCount | ( | SocketID | socket | ) | const |
Returns the count of clock cycles in which a socket was written to.
In case no data was found for the given socket in DB, returns 0.
socket | The name of the socket. |
Definition at line 656 of file ExecutionTrace.cc.
References RelationalDBQueryResult::data(), dbConnection_, RelationalDBQueryResult::hasNext(), RelationalDBQueryResult::next(), and RelationalDBConnection::query().
Referenced by DefaultICDecoderEstimator::estimateICEnergy().
|
private |
The call trace file.
Definition at line 199 of file ExecutionTrace.hh.
Referenced by addProcedureTransfer(), and ~ExecutionTrace().
|
private |
Handle to the sqlite trace database.
Definition at line 205 of file ExecutionTrace.hh.
Referenced by open(), and ~ExecutionTrace().
|
private |
Handle to the database connection;.
Definition at line 207 of file ExecutionTrace.hh.
Referenced by addBusActivity(), addBusWriteCount(), addConcurrentRegisterFileAccessCount(), addFunctionUnitOperationTriggerCount(), addInstructionExecution(), addInstructionExecutionCount(), addProcedureAddressRange(), addRegisterAccessCount(), addSocketWriteCount(), busWriteCount(), functionUnitOperationTriggerCounts(), initialize(), instructionExecutions(), open(), registerFileAccessCounts(), setSimulatedCycleCount(), simulatedCycleCount(), socketWriteCount(), and ~ExecutionTrace().
|
private |
Filename of the trace database (sqlite file).
Definition at line 197 of file ExecutionTrace.hh.
Referenced by open().
|
private |
Handle object for the queries of instruction executions.
Definition at line 209 of file ExecutionTrace.hh.
Referenced by instructionExecutions(), and ~ExecutionTrace().
|
private |
The instruction profile file.
Definition at line 201 of file ExecutionTrace.hh.
Referenced by addInstructionExecutionCount(), and ~ExecutionTrace().
|
private |
Is the database access mode read-only?
Definition at line 203 of file ExecutionTrace.hh.