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