diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index fb208649d391bfe3e4a5dafa92d9b4e2650f2ac4..e96c94b138195db402630b86e4d330a37c3b5006 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -134,8 +134,14 @@ #include <QtTest/QTest> #include <QtTest/QSignalSpy> #include <QtTest/QTestEventLoop> + +//#define WITH_BENCHMARK +#ifdef WITH_BENCHMARK +#include <valgrind/callgrind.h> #endif +#endif // WITH_TESTS + #include <climits> #define DEBUG_STATE 1 @@ -864,13 +870,14 @@ public slots: void testStateMachine2(); void testStateMachine3(); + void testBenchmark1(); + public: bool m_testSuccess; QList<TestCallBack> m_testCallbacks; #endif - public slots: void updateDebugActions(); @@ -3835,7 +3842,34 @@ void DebuggerPluginPrivate::testStateMachine3() testUnloadProject(); testFinished(); } + + +/////////////////////////////////////////////////////////////////////////// + +void DebuggerPlugin::testBenchmark() +{ + theDebuggerCore->testBenchmark1(); +} + +enum FakeEnum { FakeDebuggerCommonSettingsId }; + +void DebuggerPluginPrivate::testBenchmark1() +{ +#ifdef WITH_BENCHMARK + CALLGRIND_START_INSTRUMENTATION; + volatile Core::Id id1 = Core::Id(DEBUGGER_COMMON_SETTINGS_ID); + CALLGRIND_STOP_INSTRUMENTATION; + CALLGRIND_DUMP_STATS; + + CALLGRIND_START_INSTRUMENTATION; + volatile FakeEnum id2 = FakeDebuggerCommonSettingsId; + CALLGRIND_STOP_INSTRUMENTATION; + CALLGRIND_DUMP_STATS; #endif +} + + +#endif // if WITH_TESTS } // namespace Debugger diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 0f960f4f0e3b445b39c5534fd9b83e41d3aed995..3b476103e02fbe46645c2f358377c13e5c874784 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -77,6 +77,7 @@ private: #ifdef WITH_TESTS private slots: + void testBenchmark(); void testPythonDumpers(); void testStateMachine(); #endif