mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-26 02:21:43 +08:00
add the thread-ID to the output of JKQTPAutoOutputTimer
This commit is contained in:
parent
26a86df032
commit
07a797ef80
@ -21,7 +21,7 @@
|
|||||||
#include "jkqtcommon/jkqtpdebuggingtools.h"
|
#include "jkqtcommon/jkqtpdebuggingtools.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
namespace JKQTPAutoOutputTimer_private {
|
namespace JKQTPAutoOutputTimer_private {
|
||||||
thread_local int global_indent=0;
|
thread_local int global_indent=0;
|
||||||
@ -33,9 +33,9 @@ JKQTPAutoOutputTimer::JKQTPAutoOutputTimer(const QString& _message) :
|
|||||||
this->indent=QString(JKQTPAutoOutputTimer_private::global_indent, QLatin1Char(' '));
|
this->indent=QString(JKQTPAutoOutputTimer_private::global_indent, QLatin1Char(' '));
|
||||||
JKQTPAutoOutputTimer_private::global_indent+=4;
|
JKQTPAutoOutputTimer_private::global_indent+=4;
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
qDebug()<<this->indent<<"TIMER_START: "<<message;
|
qDebug()<<QThread::currentThread()<<": "+this->indent+"TIMER_START: "+message;
|
||||||
#else
|
#else
|
||||||
qDebug()<<this->indent<<"TIMER_START: "<<message;
|
qDebug()<<QThread::currentThread()<<": "+this->indent+"TIMER_START: "+message;
|
||||||
#endif
|
#endif
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
@ -43,9 +43,9 @@ JKQTPAutoOutputTimer::JKQTPAutoOutputTimer(const QString& _message) :
|
|||||||
JKQTPAutoOutputTimer::~JKQTPAutoOutputTimer()
|
JKQTPAutoOutputTimer::~JKQTPAutoOutputTimer()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
qDebug()<<this->indent<<"TIMER_END: "<<message<<" DUR: "<<double(nsecsElapsed())/1.0e6<<"ms";
|
qDebug()<<QThread::currentThread()<<": "+this->indent+"TIMER_END: "+message+" DUR: "<<double(nsecsElapsed())/1.0e6<<"ms";
|
||||||
#else
|
#else
|
||||||
qDebug()<<this->indent<<"TIMER_END: "<<message<<" DUR: "<<double(elapsed())/1.0e3<<"ms";
|
qDebug()<<QThread::currentThread()<<": "+this->indent+"TIMER_END: "+message+" DUR: "<<double(elapsed())/1.0e3<<"ms";
|
||||||
#endif
|
#endif
|
||||||
JKQTPAutoOutputTimer_private::global_indent-=4;
|
JKQTPAutoOutputTimer_private::global_indent-=4;
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ JKQTPAutoOutputTimer::~JKQTPAutoOutputTimer()
|
|||||||
|
|
||||||
void JKQTPAutoOutputTimer::write(const QString& message) const {
|
void JKQTPAutoOutputTimer::write(const QString& message) const {
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
qDebug()<<this->indent<<"TIMER_MESSAGE: "<<this->message<<" "<<message<<" DUR: "<<double(nsecsElapsed())/1.0e6<<"ms";
|
qDebug()<<QThread::currentThread()<<": "+this->indent+"TIMER_MESSAGE: "+this->message+" "+message+" DUR: "<<double(nsecsElapsed())/1.0e6<<"ms";
|
||||||
#else
|
#else
|
||||||
qDebug()<<this->indent<<"TIMER_MESSAGE: "<<this->message<<" "<<message<<" DUR: "<<double(elapsed())/1.0e3<<"ms";
|
qDebug()<<QThread::currentThread()<<": "+this->indent+"TIMER_MESSAGE: "+this->message+" "+message+" DUR: "<<double(elapsed())/1.0e3<<"ms";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user