Skip to content

Commit

Permalink
Cleanup of unused variables, move budget calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpwright committed Dec 5, 2023
1 parent 793f744 commit ee0fa06
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,10 @@ public static class AccumulatedCycleStats {
public static final int MAX_DOUBLING_LEN = 1024;

synchronized void accumulate(
final long targetCycleDurationMillis,
final boolean onBudget,
final long cycleTimeNanos,
final long safePoints,
final long safePointPauseTimeMillis) {
final boolean onBudget = targetCycleDurationMillis * 1000 * 1000 >= cycleTimeNanos;
if (onBudget) {
++cyclesOnBudget;
}
Expand Down Expand Up @@ -788,7 +787,7 @@ void refreshTablesAndFlushNotifications() {
private void computeStatsAndLogCycle(final long cycleTimeNanos) {
final long safePointPauseTimeMillis = jvmIntrospectionContext.deltaSafePointPausesTimeMillis();
accumulatedCycleStats.accumulate(
getTargetCycleDurationMillis(),
isCycleOnBudget(cycleTimeNanos),
cycleTimeNanos,
jvmIntrospectionContext.deltaSafePointPausesCount(),
safePointPauseTimeMillis);
Expand All @@ -815,7 +814,6 @@ private void computeStatsAndLogCycle(final long cycleTimeNanos) {
}
entry = entry.append("ms, lockWaitTime=");
entry = appendAsMillisFromNanos(entry, currentCycleLockWaitTotalNanos);
entry = logCycleExtra(entry);
entry.append("ms").endl();
return;
}
Expand All @@ -829,17 +827,15 @@ private void computeStatsAndLogCycle(final long cycleTimeNanos) {
}
}

protected abstract LogEntry logCycleExtra(LogEntry entry);

/**
* Get the target duration of an update cycle, including the updating phase and the idle phase. This is also the
* target interval between the start of one cycle and the start of the next.
* Is the provided cycle time on budget?
*
* @param cycleTimeNanos the cycle time, in nanoseconds
*
* @return The target cycle duration
* @return true if the cycle time is within the desired budget
*/
public long getTargetCycleDurationMillis() {
// TODO: REMOVE THIS FROM THE BASE AND KEEP ONLY IN THE MAIN
return 0;
public boolean isCycleOnBudget(long cycleTimeNanos) {
return true;
}

private void logSuppressedCycles() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public LogOutput append(@NotNull final LogOutput logOutput) {
return logOutput.append("EventDrivenUpdateGraph-").append(getName());
}

@Override
protected LogEntry logCycleExtra(LogEntry entry) {
return entry;
}

@Override
public int parallelismFactor() {
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import io.deephaven.engine.updategraph.*;
import io.deephaven.engine.util.systemicmarking.SystemicObjectTracker;
import io.deephaven.internal.log.LoggerFactory;
import io.deephaven.io.log.LogEntry;
import io.deephaven.io.logger.Logger;
import io.deephaven.util.SafeCloseable;
import io.deephaven.util.annotations.TestUseOnly;
Expand Down Expand Up @@ -100,17 +99,6 @@ public static Builder newBuilder(final String name) {
private final long defaultTargetCycleDurationMillis;
private volatile long targetCycleDurationMillis;

/**
* Accumulated delays due to intracycle yields for the current cycle (or previous, if idle).
*/
// TODO: WHY UNUSED?
private long currentCycleYieldTotalNanos;
/**
* Accumulated delays due to intracycle sleeps for the current cycle (or previous, if idle).
*/
private long currentCycleSleepTotalNanos;


/**
* The number of threads in our executor service for dispatching notifications. If 1, then we don't actually use the
* executor service; but instead dispatch all the notifications on the PeriodicUpdateGraph run thread.
Expand Down Expand Up @@ -261,6 +249,11 @@ public long getTargetCycleDurationMillis() {
return targetCycleDurationMillis;
}

@Override
public boolean isCycleOnBudget(long cycleTimeNanos) {
return cycleTimeNanos <= MILLISECONDS.toNanos(targetCycleDurationMillis);
}

/**
* Resets the run cycle time to the default target configured via the {@link Builder} setting.
*
Expand Down Expand Up @@ -929,16 +922,6 @@ int threadCount() {
}
}

@Override
protected LogEntry logCycleExtra(LogEntry entry) {
entry.append("ms, yieldTime=");
entry = appendAsMillisFromNanos(entry, currentCycleYieldTotalNanos);
entry = entry.append("ms, sleepTime=");
entry = appendAsMillisFromNanos(entry, currentCycleSleepTotalNanos);
return entry;
}


@TestUseOnly
private class ControlledNotificationProcessor implements NotificationProcessor {

Expand Down

0 comments on commit ee0fa06

Please sign in to comment.