RealtimeLogger: Fixed coding guideline issues.
Change-Id: I1172e0c60e2d6e895b4d3f99eb1a023c348bd3b3
This commit is contained in:
@ -7,7 +7,6 @@ using namespace fail;
|
|||||||
|
|
||||||
bool RealtimeLogger::run()
|
bool RealtimeLogger::run()
|
||||||
{
|
{
|
||||||
|
|
||||||
MemoryManager& mm = simulator.getMemoryManager();
|
MemoryManager& mm = simulator.getMemoryManager();
|
||||||
|
|
||||||
uint32_t value; //! @todo more generic datatype
|
uint32_t value; //! @todo more generic datatype
|
||||||
@ -16,35 +15,27 @@ bool RealtimeLogger::run()
|
|||||||
MemAccessListener ev_mem(m_symbol.getAddress());
|
MemAccessListener ev_mem(m_symbol.getAddress());
|
||||||
|
|
||||||
if(m_ostream.is_open()) {
|
if(m_ostream.is_open()) {
|
||||||
m_log << "Writing output to: " << m_outputfile << std::endl;
|
m_log << "Writing output to: " << m_outputfile << std::endl;
|
||||||
while (true) {
|
while (true) {
|
||||||
simulator.addListenerAndResume(&ev_mem);
|
simulator.addListenerAndResume(&ev_mem);
|
||||||
|
/* A Memory Accesses happend: Get simulation time and log it */
|
||||||
/* A Memory Accesses happend: Get simulation time and log it */
|
fail::simtime_t simtime = simulator.getTimerTicks();
|
||||||
fail::simtime_t simtime = simulator.getTimerTicks();
|
mm.getBytes(m_symbol.getAddress(), m_symbol.getSize(), &value);
|
||||||
|
handleEvent(simtime, value);
|
||||||
mm.getBytes(m_symbol.getAddress(), m_symbol.getSize(), &value);
|
}
|
||||||
|
|
||||||
handleEvent(simtime, value);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
m_log << "No output file." << std::endl;
|
m_log << "No output file." << std::endl;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RealtimeLogger::handleEvent(fail::simtime_t simtime, uint32_t value)
|
void RealtimeLogger::handleEvent(fail::simtime_t simtime, uint32_t value)
|
||||||
{
|
{
|
||||||
|
|
||||||
simtime_t per_second = simulator.getTimerTicksPerSecond();
|
simtime_t per_second = simulator.getTimerTicksPerSecond();
|
||||||
|
|
||||||
double sec = (double)simtime / per_second;
|
double sec = (double)simtime / per_second;
|
||||||
|
|
||||||
double msec = sec*1000;
|
double msec = sec*1000;
|
||||||
|
|
||||||
if(m_ostream.is_open()){
|
if(m_ostream.is_open()){
|
||||||
m_ostream << std::dec << msec << ";" << value << std::endl;
|
m_ostream << std::dec << msec << ";" << value << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,10 @@ public:
|
|||||||
* @param outputfile The path to the file to write the output to
|
* @param outputfile The path to the file to write the output to
|
||||||
*/
|
*/
|
||||||
RealtimeLogger( const fail::ElfSymbol & symbol, const std::string& outputfile ) : m_symbol(symbol), m_outputfile(outputfile) , m_log("RTLogger", false) {
|
RealtimeLogger( const fail::ElfSymbol & symbol, const std::string& outputfile ) : m_symbol(symbol), m_outputfile(outputfile) , m_log("RTLogger", false) {
|
||||||
m_ostream.open(m_outputfile.c_str() );
|
m_ostream.open(m_outputfile.c_str() );
|
||||||
if(!m_ostream.is_open()){
|
if(!m_ostream.is_open()){
|
||||||
m_log << "Could not open " << m_outputfile.c_str() << " for writing." << std::endl;
|
m_log << "Could not open " << m_outputfile.c_str() << " for writing." << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool run();
|
bool run();
|
||||||
|
|||||||
Reference in New Issue
Block a user