Showing the changes to interface/src/scripting/TestScriptingInterface.cpp (1 of 76 files). Show all
Unified · Split
| @@ -10,6 +10,10 @@ · 9 unmodified lines | ||
| 10 | 10 | #include "TestScriptingInterface.h" |
| 11 | 11 | |
| 12 | 12 | #include <QtCore/QCoreApplication> |
| 13 | +#include <QtCore/QLoggingCategory> | |
| 14 | + | |
| 15 | +#include <DependencyManager.h> | |
| 16 | +#include <Trace.h> | |
| 13 | 17 | |
| 14 | 18 | TestScriptingInterface* TestScriptingInterface::getInstance() { |
| 15 | 19 | static TestScriptingInterface sharedInstance; |
| @@ -28,3 +32,27 @@ void TestScriptingInterface::waitForDownloadIdle() { · 12 unmodified lines | ||
| 28 | 32 | |
| 29 | 33 | void TestScriptingInterface::waitIdle() { |
| 30 | 34 | } |
| 35 | + | |
| 36 | +bool TestScriptingInterface::startTracing(QString logrules) { | |
| 37 | + if (!logrules.isEmpty()) { | |
| 38 | + QLoggingCategory::setFilterRules(logrules); | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (!DependencyManager::isSet<tracing::Tracer>()) { | |
| 42 | + return false; | |
| 43 | + } | |
| 44 | + | |
| 45 | + DependencyManager::get<tracing::Tracer>()->startTracing(); | |
| 46 | + return true; | |
| 47 | +} | |
| 48 | + | |
| 49 | +bool TestScriptingInterface::stopTracing(QString filename) { | |
| 50 | + if (!DependencyManager::isSet<tracing::Tracer>()) { | |
| 51 | + return false; | |
| 52 | + } | |
| 53 | + | |
| 54 | + auto tracer = DependencyManager::get<tracing::Tracer>(); | |
| 55 | + tracer->stopTracing(); | |
| 56 | + tracer->serialize(filename); | |
| 57 | + return true; | |
| 58 | +} | |