nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp
2index 06f5e7e7e335..8407d664886a 100644
3--- a/lib/Driver/Compilation.cpp
4+++ b/lib/Driver/Compilation.cpp
5@@ -340,6 +340,9 @@ private:
6 void Compilation::ExecuteJobs(const JobList &Jobs,
7 FailingCommandList &FailingCommands,
8 bool LogOnly) const {
9+ // If >1 job, log as each job finishes so can see progress while building many offloads
10+ const bool logJobs = Jobs.size() > 1;
11+ auto start_time = std::chrono::steady_clock::now();
12 // According to UNIX standard, driver need to continue compiling all the
13 // inputs on the command line even one of them failed.
14 // In all but CLMode, execute all the jobs unless the necessary inputs for the
15@@ -364,11 +367,25 @@ void Compilation::ExecuteJobs(const JobList &Jobs,
16
17 JS.setJobState(Next, JobScheduler::JS_RUN);
18 auto Work = [&, Next]() {
19+ auto job_start_time = std::chrono::steady_clock::now();
20 const Command *FailingCommand = nullptr;
21 if (int Res = ExecuteCommand(*Next, FailingCommand, LogOnly)) {
22 FailingCommands.push_back(std::make_pair(Res, FailingCommand));
23 JS.setJobState(Next, JobScheduler::JS_FAIL);
24 } else {
25+ if (logJobs && Next) {
26+ auto now = std::chrono::steady_clock::now();
27+ auto job_duration = std::chrono::duration_cast<std::chrono::seconds>(now - job_start_time).count();
28+ auto duration = std::chrono::duration_cast<std::chrono::seconds>(now - start_time).count();
29+ if (duration > 10 && job_duration > 0) {
30+ if (Next->getOutputFilenames().empty())
31+ if (Next->getExecutable()) llvm::errs() << "Job completed: " << Next->getExecutable() << "\n";
32+ else (llvm::errs() << "Job completed: "), Next->Print(llvm::errs(), "\n", true);
33+ else
34+ llvm::errs() << "Job completed: " << Next->getOutputFilenames().front().c_str() << "\n";
35+ }
36+ }
37+
38 JS.setJobState(Next, JobScheduler::JS_DONE);
39 }
40 };