utility: Added Tracer for collecting time measurements

* define TRACING_ENABLED in utility/tracing.h to enable tracing
* invoke TraceEvent by writing TRACE() at start of function or scope
* provide an event name with TRACE("name")
* press SPACE to show collected traces history and report with accumulated times
This commit is contained in:
Eberhard Graether
2016-06-16 12:03:34 +02:00
parent 6b31a43f75
commit 9560cc4ea6
14 changed files with 401 additions and 9 deletions
+9
View File
@@ -37,6 +37,7 @@
#include "utility/messaging/type/MessageWindowFocus.h"
#include "utility/messaging/type/MessageZoom.h"
#include "utility/ResourcePaths.h"
#include "utility/tracing.h"
#include "utility/UserPaths.h"
#include "version.h"
#include "isTrial.h"
@@ -507,6 +508,11 @@ void QtMainWindow::handleEscapeShortcut()
MessageInterruptTasks().dispatch();
}
void QtMainWindow::handleSpaceShortcut()
{
PRINT_TRACES();
}
void QtMainWindow::setupProjectMenu()
{
QMenu *menu = new QMenu(tr("&Project"), this);
@@ -662,6 +668,9 @@ void QtMainWindow::setupShortcuts()
{
m_escapeShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
connect(m_escapeShortcut, SIGNAL(activated()), SLOT(handleEscapeShortcut()));
m_spaceShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
connect(m_spaceShortcut, SIGNAL(activated()), SLOT(handleSpaceShortcut()));
}
QtMainWindow::DockWidget* QtMainWindow::getDockWidgetForView(View* view)
+2
View File
@@ -131,6 +131,7 @@ public slots:
void toggleView(View* view, bool fromMenu);
void handleEscapeShortcut();
void handleSpaceShortcut();
void updateRecentProjectMenu();
@@ -170,6 +171,7 @@ private:
QtWindowStack m_windowStack;
QShortcut* m_escapeShortcut;
QShortcut* m_spaceShortcut;
};
#endif // QT_MAIN_WINDOW_H