public class ProcessTracker extends com.google.common.util.concurrent.AbstractScheduledService implements AutoCloseable
Resource consumption has to be gathered periodically because it can only be retrieved while the process is still alive and we have no way of knowing or even controlling when the process is going to finish (assuming it finishes execution on its own). Furthermore, for some metrics (such as memory usage) only the current values get reported and we need to keep track of peak usage manually. Gathering only the current values just before the process finishes (assuming this was possible) would likely be highly inaccurate anyways as the process probably released most of its resources by that time.
| Modifier and Type | Class and Description |
|---|---|
static class |
ProcessTracker.ProcessResourceConsumptionEvent |
| Constructor and Description |
|---|
ProcessTracker(BuckEventBus buckEventBus,
InvocationInfo invocationInfo,
boolean isDaemon,
boolean deepEnabled) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
runOneIteration() |
protected com.google.common.util.concurrent.AbstractScheduledService.Scheduler |
scheduler() |
protected void |
shutDown() |
protected void |
startUp() |
public ProcessTracker(BuckEventBus buckEventBus, InvocationInfo invocationInfo, boolean isDaemon, boolean deepEnabled)
protected void startUp()
startUp in class com.google.common.util.concurrent.AbstractScheduledServiceprotected void runOneIteration()
runOneIteration in class com.google.common.util.concurrent.AbstractScheduledServiceprotected void shutDown()
shutDown in class com.google.common.util.concurrent.AbstractScheduledServiceprotected com.google.common.util.concurrent.AbstractScheduledService.Scheduler scheduler()
scheduler in class com.google.common.util.concurrent.AbstractScheduledServicepublic void close()
close in interface AutoCloseable