[llvm] r237054 - [lib/Fuzzer] when running multiple fuzzing processes, print something every 10 minutes to avoid buildbot timeouts
Kostya Serebryany
kcc at google.com
Mon May 11 14:31:51 PDT 2015
Author: kcc
Date: Mon May 11 16:31:51 2015
New Revision: 237054
URL: http://llvm.org/viewvc/llvm-project?rev=237054&view=rev
Log:
[lib/Fuzzer] when running multiple fuzzing processes, print something every 10 minutes to avoid buildbot timeouts
Modified:
llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=237054&r1=237053&r2=237054&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Mon May 11 16:31:51 2015
@@ -13,6 +13,7 @@
#include "FuzzerInternal.h"
#include <cstring>
+#include <chrono>
#include <unistd.h>
#include <iostream>
#include <thread>
@@ -122,9 +123,18 @@ static void ParseFlags(int argc, char **
}
}
+static std::mutex Mu;
+
+static void PulseThread() {
+ while (true) {
+ std::this_thread::sleep_for(std::chrono::seconds(600));
+ std::lock_guard<std::mutex> Lock(Mu);
+ std::cerr << "pulse...\n";
+ }
+}
+
static void WorkerThread(const std::string &Cmd, std::atomic<int> *Counter,
int NumJobs, std::atomic<bool> *HasErrors) {
- static std::mutex CerrMutex;
while (true) {
int C = (*Counter)++;
if (C >= NumJobs) break;
@@ -135,7 +145,7 @@ static void WorkerThread(const std::stri
int ExitCode = system(ToRun.c_str());
if (ExitCode != 0)
*HasErrors = true;
- std::lock_guard<std::mutex> Lock(CerrMutex);
+ std::lock_guard<std::mutex> Lock(Mu);
std::cerr << "================== Job " << C
<< " exited with exit code " << ExitCode
<< " =================\n";
@@ -154,10 +164,12 @@ static int RunInMultipleProcesses(int ar
Cmd += " ";
}
std::vector<std::thread> V;
+ std::thread Pulse(PulseThread);
for (int i = 0; i < NumWorkers; i++)
V.push_back(std::thread(WorkerThread, Cmd, &Counter, NumJobs, &HasErrors));
for (auto &T : V)
T.join();
+ Pulse.join();
return HasErrors ? 1 : 0;
}
More information about the llvm-commits
mailing list