Move --traceFile option to start of main()

This commit is contained in:
Simon Walton 2018-04-09 15:45:58 -07:00
parent 9b6306601a
commit 513a4875f0
2 changed files with 14 additions and 3 deletions

View file

@ -959,6 +959,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
#if 0
{
const QString TEST_SCRIPT = "--testScript";
const QString TRACE_FILE = "--traceFile";
@ -976,6 +977,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
}
}
}
#endif
// make sure the debug draw singleton is initialized on the main thread.
DebugDraw::getInstance().removeMarker("");

View file

@ -42,9 +42,18 @@ extern "C" {
int main(int argc, const char* argv[]) {
setupHifiApplication(BuildInfo::INTERFACE_NAME);
auto tracer = DependencyManager::set<tracing::Tracer>();
tracer->startTracing();
const char * traceFile = "";
{
for (int a = 1; a < argc; ++a) {
if (strcmp(argv[a], "--traceFile") == 0 && argc > a + 1) {
traceFile = argv[a + 1];
tracer->startTracing();
break;
}
}
}
PROFILE_SYNC_BEGIN(startup, "main startup", "");
#ifdef Q_OS_LINUX
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
#endif
@ -283,7 +292,7 @@ int main(int argc, const char* argv[]) {
server.close();
tracer->stopTracing();
tracer->serialize(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Traces/trace-startup.json.gz");
tracer->serialize(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/" + traceFile);
}
Application::shutdownPlugins();