aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOrion Hodson <oth@google.com>2020-11-03 16:33:54 +0000
committerOrion Hodson <oth@google.com>2020-11-03 16:42:48 +0000
commit4ad7f448f91b45063d4f1387f00af58e36a7aac1 (patch)
treeb75d389f23adf50dbbd62de334a7777e1733b177 /src
parent203a53e53deeede73882cc5b1ca93c79a4f8c005 (diff)
downloadvogar-4ad7f448f91b45063d4f1387f00af58e36a7aac1.tar.gz
Vogar: stop busy waiting on tasks to time out
Vogar's timeout code consumed 100% cpu because it set the timeout in the past rather than the future so would continuously reschedule the timeout until it finally elapsed. This may help with vogar timeout issues on the ART buildbots where we run with a limited number of cores. Bug: 161420453 Test: art/tools/run-libcore-tests.sh '--mode=host' '--variant=X32' \ and inspect CPU usage (top) and thread stacks (jps and jstack -e). Change-Id: I4ad475eb2f86494a939d1405b20efdf66d2d4a2a
Diffstat (limited to 'src')
-rw-r--r--src/vogar/commands/Command.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vogar/commands/Command.java b/src/vogar/commands/Command.java
index dbd4daf..60c30b7 100644
--- a/src/vogar/commands/Command.java
+++ b/src/vogar/commands/Command.java
@@ -308,7 +308,7 @@ public final class Command {
*/
private abstract class TimeoutTask implements Runnable {
public final void schedule() {
- timer.schedule(this, System.nanoTime() - timeoutNanoTime, TimeUnit.NANOSECONDS);
+ timer.schedule(this, timeoutNanoTime - System.nanoTime(), TimeUnit.NANOSECONDS);
}
protected abstract void onTimeout(Process process);
@@ -324,7 +324,7 @@ public final class Command {
onTimeout(process);
} else {
// if the kill time has been pushed back, reschedule
- timer.schedule(this, System.nanoTime() - timeoutNanoTime, TimeUnit.NANOSECONDS);
+ schedule();
}
}
}