Skip to content

Commit 08ab182

Browse files
committed
debug(judge): log actual compile elapsed time
Record how long g++ compilation actually takes to diagnose whether CI timeouts are due to slow runners or other issues.
1 parent 3460944 commit 08ab182

1 file changed

Lines changed: 30 additions & 26 deletions

File tree

src/core/taskjudger.cpp

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -279,38 +279,42 @@ auto TaskJudger::traditionalTaskPrepare() -> bool {
279279
compilerProcess.kill();
280280
compilerProcess.waitForFinished(3000);
281281
compileState = CompileTimeLimitExceeded;
282-
LOG("traditionalTaskPrepare: compile TIMEOUT for", contestantName);
283-
} else if (compilerProcess.exitCode() != 0) {
284-
compileState = CompileError;
285-
compileMessage =
286-
QString::fromLocal8Bit(compilerProcess.readAllStandardOutput().constData());
282+
LOG("traditionalTaskPrepare: compile TIMEOUT for", contestantName,
283+
"elapsed=", timer.elapsed(), "ms");
287284
} else {
288-
if (i->getCompilerType() == Compiler::Typical) {
289-
if (! QDir(QDir::toNativeSeparators(temporaryDir.path()) + QDir::separator() +
290-
contestantName)
291-
.exists(executableFile)) {
292-
compileState = InvalidCompiler;
293-
} else {
294-
compileState = CompileSuccessfully;
295-
}
285+
LOG("traditionalTaskPrepare: compile done for", contestantName,
286+
"elapsed=", timer.elapsed(), "ms, exitCode=", compilerProcess.exitCode());
287+
if (compilerProcess.exitCode() != 0) {
288+
compileState = CompileError;
289+
compileMessage =
290+
QString::fromLocal8Bit(compilerProcess.readAllStandardOutput().constData());
296291
} else {
297-
QStringList filters = i->getBytecodeExtensions();
298-
299-
for (int k = 0; k < filters.size(); k++) {
300-
filters[k] = QString("*.") + filters[k];
301-
}
302-
303-
if (QDir(QDir::toNativeSeparators(temporaryDir.path()) + QDir::separator() +
304-
contestantName)
305-
.entryList(filters, QDir::Files)
306-
.empty()) {
307-
compileState = InvalidCompiler;
292+
if (i->getCompilerType() == Compiler::Typical) {
293+
if (! QDir(QDir::toNativeSeparators(temporaryDir.path()) + QDir::separator() +
294+
contestantName)
295+
.exists(executableFile)) {
296+
compileState = InvalidCompiler;
297+
} else {
298+
compileState = CompileSuccessfully;
299+
}
308300
} else {
309-
compileState = CompileSuccessfully;
301+
QStringList filters = i->getBytecodeExtensions();
302+
303+
for (int k = 0; k < filters.size(); k++) {
304+
filters[k] = QString("*.") + filters[k];
305+
}
306+
307+
if (QDir(QDir::toNativeSeparators(temporaryDir.path()) + QDir::separator() +
308+
contestantName)
309+
.entryList(filters, QDir::Files)
310+
.empty()) {
311+
compileState = InvalidCompiler;
312+
} else {
313+
compileState = CompileSuccessfully;
314+
}
310315
}
311316
}
312317
}
313-
}
314318

315319
makeDialogAlert(tr("Compiled Successfully"));
316320
}

0 commit comments

Comments
 (0)