forked from qt-creator/qt-creator
Clang: Allow to time high-level functions
...by enabling the logging rule:
qtc.clangbackend.timers=true
Change-Id: I085c6bbebc0343b74bcb90119d1ebb80ad49518d
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
@@ -35,12 +35,15 @@
|
||||
#include <utf8string.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QLoggingCategory>
|
||||
#include <QString>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
namespace {
|
||||
|
||||
Q_LOGGING_CATEGORY(timersLog, "qtc.clangbackend.timers");
|
||||
|
||||
class DebugInspectionDir : public QTemporaryDir
|
||||
{
|
||||
public:
|
||||
@@ -96,4 +99,16 @@ Utf8String debugId(const FileContainer &fileContainer)
|
||||
return id;
|
||||
}
|
||||
|
||||
VerboseScopeDurationTimer::VerboseScopeDurationTimer(const char *id)
|
||||
: id(id)
|
||||
{
|
||||
if (timersLog().isDebugEnabled())
|
||||
timer.start();
|
||||
}
|
||||
|
||||
VerboseScopeDurationTimer::~VerboseScopeDurationTimer()
|
||||
{
|
||||
qCDebug(timersLog) << id << "needed" << timer.elapsed() << "ms";
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Reference in New Issue
Block a user