Add --disableWatchdog command-line option

Watchdog still runs but doesn't abort on timeout.
Also fixes for previous tracing improvements.
This commit is contained in:
Simon Walton 2018-04-12 09:28:28 -07:00
parent 888fca2127
commit 5c141aa5e9
2 changed files with 12 additions and 5 deletions

View file

@ -399,7 +399,8 @@ public:
static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples
// Set the heartbeat on launch
DeadlockWatchdogThread() {
DeadlockWatchdogThread(bool crashOnTrigger = true)
: _crashOnTrigger(crashOnTrigger) {
setObjectName("Deadlock Watchdog");
// Give the heartbeat an initial value
_heartbeat = usecTimestampNow();
@ -490,7 +491,9 @@ public:
// Don't actually crash in debug builds, in case this apparent deadlock is simply from
// the developer actively debugging code
#ifdef NDEBUG
if (_crashOnTrigger) {
deadlockDetectionCrash();
}
#endif
}
}
@ -502,6 +505,8 @@ public:
static std::atomic<int> _maxElapsedAverage;
static ThreadSafeMovingAverage<int, HEARTBEAT_SAMPLES> _movingAverage;
const bool _crashOnTrigger;
bool _quit { false };
};
@ -957,7 +962,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
bool watchdogCrashWhenTriggered = true;
{
const QString TEST_SCRIPT = "--testScript";
const QStringList args = arguments();
@ -967,6 +972,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
if (QFileInfo(testScriptPath).exists()) {
setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));
}
} else if (args.at(i) == QStringLiteral("--disableWatchdog")) {
watchdogCrashWhenTriggered = false;
}
}
}
@ -1014,7 +1021,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Set up a watchdog thread to intentionally crash the application on deadlocks
if (!DISABLE_WATCHDOG) {
(new DeadlockWatchdogThread())->start();
(new DeadlockWatchdogThread(watchdogCrashWhenTriggered))->start();
}
// Set File Logger Session UUID

View file

@ -73,7 +73,7 @@ class JobConcept {
public:
using Config = JobConfig;
JobConcept(const std::string& name, QConfigPointer config) : _name(name), _config(config) {}
JobConcept(const std::string& name, QConfigPointer config) : _config(config), _name(name) {}
virtual ~JobConcept() = default;
const std::string& getName() const { return _name; }
@ -330,7 +330,7 @@ public:
}
void applyConfiguration() override {
Duration profileRange(trace_render(), ("configure::" + JobConcept::getName()).c_str());
Duration profileRange(trace_render(), ("configure::" + JobConcept::getName()).c_str());
jobConfigure(_data, *std::static_pointer_cast<C>(Concept::_config));
for (auto& job : TaskConcept::_jobs) {
job.applyConfiguration();