Commit 12f1f3b4 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Make debug logs more readable by adding clock time.

This should help diagnose if timeouts occur due to a hang or just a slow test.
parent c85cca33
...@@ -128,7 +128,6 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player) ...@@ -128,7 +128,6 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
// playback loop, and it continues. // playback loop, and it continues.
this->PlayBackStatus = true; // success. this->PlayBackStatus = true; // success.
this->PlayBackFinished = false; this->PlayBackFinished = false;
this->PlaybackStartTime = QTime::currentTime();
while (!this->PlayBackFinished) while (!this->PlayBackFinished)
{ {
this->playEvent(); this->playEvent();
...@@ -207,7 +206,8 @@ void pqEventDispatcher::playEvent(int indent) ...@@ -207,7 +206,8 @@ void pqEventDispatcher::playEvent(int indent)
#endif #endif
if (print_debug) if (print_debug)
{ {
cout << QTime::currentTime().secsTo(this->PlaybackStartTime) << " : " cout << QTime::currentTime().toString("hh:mm:ss").toStdString().c_str()
<< " : "
<< QString().fill(' ', 4*indent).toStdString().c_str() << QString().fill(' ', 4*indent).toStdString().c_str()
<< local_counter << ": Test (" << indent << "): " << local_counter << ": Test (" << indent << "): "
<< pretty_name.toStdString().c_str() << ": " << pretty_name.toStdString().c_str() << ": "
...@@ -220,16 +220,21 @@ void pqEventDispatcher::playEvent(int indent) ...@@ -220,16 +220,21 @@ void pqEventDispatcher::playEvent(int indent)
this->BlockTimer.stop(); this->BlockTimer.stop();
//QCoreApplication::sendPostedEvents(); //QCoreApplication::sendPostedEvents();
//QCoreApplication::flush(); //QCoreApplication::flush();
if (print_debug) { cout << " -- pre-processEventsAndWait: " << if (print_debug)
local_counter <<endl;} {
this->processEventsAndWait(QT_TESTING_EVENT_PLAYBACK_DELAY); // let what's going to happen after the cout << " -- pre-processEventsAndWait: " << local_counter <<endl;
// playback, happen. }
if (print_debug) { cout << " -- post-processEventsAndWait: " << // let what's going to happen after the playback, happen.
local_counter <<endl;} this->processEventsAndWait(QT_TESTING_EVENT_PLAYBACK_DELAY);
if (print_debug)
{
cout << " -- post-processEventsAndWait: " << local_counter <<endl;
}
this->BlockTimer.stop(); this->BlockTimer.stop();
if (print_debug) if (print_debug)
{ {
cout << QTime::currentTime().secsTo(this->PlaybackStartTime) << " : " cout << QTime::currentTime().toString("hh:mm:ss").toStdString().c_str()
<< " : "
<< QString().fill(' ', 4*indent).toStdString().c_str() << QString().fill(' ', 4*indent).toStdString().c_str()
<< local_counter << ": Done" << endl; << local_counter << ": Done" << endl;
} }
......
...@@ -84,7 +84,6 @@ protected: ...@@ -84,7 +84,6 @@ protected:
pqEventSource* ActiveSource; pqEventSource* ActiveSource;
pqEventPlayer* ActivePlayer; pqEventPlayer* ActivePlayer;
QTimer BlockTimer; QTimer BlockTimer;
QTime PlaybackStartTime;
}; };
#endif // !_pqEventDispatcher_h #endif // !_pqEventDispatcher_h
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment