java.lang.Object
net.i2p.router.Tuner.BaseParam
net.i2p.router.Tuner.PumperIdleLpsParam
- All Implemented Interfaces:
Tuner.TunableParam
- Enclosing class:
Tuner
Tunes the EventPumper max idle loop rate (
ntcp.pumper.maxIdleLps) against the observed NTCP loop rate. This is the real CPU governor for idle busy-spin: the pumper enforces a minimum idle iteration time, so lowering the rate curbs busy-spin even when selector wakeups defeat the select() timeout. Target: raise the ceiling when real I/O is flowing so work is never throttled, hold when idle (observed rate tracks the cap while the limiter is engaged), and settle back to default.Field Summary
Fields inherited from class Tuner.BaseParam
_autotune, _autoTuning, _cpuDriven, _ctx, _defaultMax, _defaultMin, _defaultStep, _defaultValue, _description, _effMax, _factoryDefault, _firstTick, _health, _historyCount, _initialValue, _log, _max, _min, _name, _override, _propPrefix, _statHistory, _statName, _step, _subsystem, _valueHistory, sharedAutotuneModifier and TypeFieldDescriptionprotected final Tuner.AutotuneConfigAutotune profile for this tunable parameter.protected booleanWhether autotuning is active for this parameter.protected booleanWhether this param's value is being driven by CPU load rather than its own stat.protected final RouterContextRouter context.protected final intDefault maximum value from code or config.protected final intDefault minimum value from code or config.protected final intDefault step/increment size for adjustments.protected intFactory default: value before any tuning.protected final StringHuman-readable label for display in the Tuner UI.protected intEffective ceiling = min(_max, memory-derived bound); never exceeds _max.protected final intCode-level default captured at construction time.protected booleanTrue until firstTuner.BaseParam.update()call — applies persisted value from autotune.config.protected Tuner.SystemHealthHealth score and subsystem for autotune decisions.protected intNumber of valid entries in _valueHistory / _statHistory.protected final intLast known value (from persistence or runtime default).protected final LogClass logger.protected intCurrent maximum value (may differ from default after tuning).protected intCurrent minimum value (may differ from default after tuning).protected final StringInternal config property key (e.g.protected intUser-set override value, or Integer.MIN_VALUE if unset.protected final StringConfig key prefix for property lookups.protected final double[]Rolling window of recent stat values for trend analysis.protected final StringRouter stat name for observed value feedback.protected intCurrent step/increment size (may differ from default).protected final StringSubsystem identifier this parameter belongs to.protected final int[]Rolling window of recent tunable values for trend analysis.(package private) static Tuner.AutotuneConfigShared instance — set once in Tuner constructor, used by all BaseParams.Constructor Summary
ConstructorsConstructorDescriptionCreates the parameter that caps the NTCP pumper idle loops per second.Method Summary
All MethodsModifier and TypeMethodDescriptionprotected voidapplyValue(int value) Apply the tunable value to the router configuration.protected intcomputeTarget(double observed) Target tunable value computed from the observed stat.protected doubleObserved stat value used for autotuning.protected intCurrent runtime value read from the router configuration.Methods inherited from class Tuner.BaseParam
clamp, decisionReason, getAdditionalEventCount, getAdditionalEventCountHourly, getAdditionalStat, getAdditionalStat5Min, getAdditionalStatHourly, getAdditionalStatLong, getBuildSuccessRate, getCoDelDropEventCount, getCurrentValue, getDefaultMax, getDefaultMin, getDefaultStep, getDefaultValue, getDescription, getHeavyTransitThreshold, getMax, getMessageReceiverUtilization, getMin, getName, getObservedRTT, getPacketHandlerUtilization, getPumperUtilization, getReaderUtilization, getSendFinisherUtilization, getShareBps, getStatHistory, getStatPeriodStamp, getStep, getStreamingLossRate, getSubsystem, getSustainedHeavyTransitThreshold, getValueHistory, getWriterUtilization, isAutoTuning, persistValue, reclaimIfIdle, recordHistory, refreshDefault, refreshRanges, setHealth, setOverride, signalIsFresh, snapshot, updateModifier and TypeMethodDescriptionprotected static intclamp(int current, int target, int step) Move from current toward target, but at most one step per cycle.protected StringWhy the current target was chosen, for the change line.protected doublegetAdditionalEventCount(RouterContext ctx, String statName) Fetch the event count for an additional stat using the 60s period.protected doublegetAdditionalEventCountHourly(RouterContext ctx, String statName) Fetch the event count for an additional stat using the 1-hour period.protected doublegetAdditionalStat(RouterContext ctx, String statName) Fetch an additional stat value for cross-reference decisions.protected doublegetAdditionalStat5Min(RouterContext ctx, String statName) Fetch an additional stat value using the 5-minute average.protected doublegetAdditionalStatHourly(RouterContext ctx, String statName) Fetch an additional stat value using the 1-hour average.protected doublegetAdditionalStatLong(RouterContext ctx, String statName) Fetch an additional stat value using the 10-minute average.protected doubleCompute actual tunnel build success rate from event counts.protected doublegetCoDelDropEventCount(RouterContext ctx, String prefix) Fetch the total CoDel drop event count across all priority levels.intThe value in effect right now.protected intEffective default max — override for bandwidth-scaled params.protected intEffective default min — override for bandwidth-scaled params.protected intEffective default step — override for bandwidth-scaled params.intDefault value.Param description.protected static intTransit bandwidth threshold for "heavy" — 80% of configured share bandwidth.intgetMax()Maximum value.protected doubleUDP message receiver pool utilization (0.0-1.0).intgetMin()Minimum value.getName()Param name.protected doublegetObservedRTT(RouterContext ctx, String primaryStat) Fetch observed RTT, falling back toudp.sendConfirmTimewhen the primary stat has no events (lightly loaded router).protected doubleUDP packet handler pool utilization (0.0-1.0).protected doubleTunnel pumper pool utilization (0.0-1.0).protected doubleNTCP reader pool utilization (0.0-1.0).protected doubleNTCP send finisher pool utilization (0.0-1.0).protected static intgetShareBps(RouterContext ctx) Current share bandwidth in bytes per second.double[]Rolling window of recent stat values.protected doublegetStatPeriodStamp(RouterContext ctx, String statName) When the window behind a stat's event count last completed, in ms, or NaN when it cannot be determined.intgetStep()Step size.protected doubleRecent streaming retransmission rate for this tuning cycle.Subsystem name.protected static intTransit bandwidth threshold for "sustained heavy" — 50% of configured share.int[]Rolling window of recent tunable values.protected doubleNTCP writer pool utilization (0.0-1.0).booleanWhether auto-tuning is enabled.protected voidpersistValue(RouterContext ctx, int value) Persist a tuned value to autotune.config.protected static intreclaimIfIdle(double utilization, int current, int min, double idleThreshold) Reclaim parked threads from a thread pool that is massively under-utilized.protected voidrecordHistory(double observed) Record history.voidRe-read the default value from autotune.config for live updates.voidRe-read min/max/step from autotune.config — live update, no restart.(package private) voidsetHealth(Tuner.SystemHealth health) The current system health score for this update cycle.voidsetOverride(int value) A manual override value.(package private) static booleansignalIsFresh(double periodStamp, double lastStamp) Whether a signal reading is from a window that closed since the stored stamp.snapshot()Capture snapshot of current tunable state for display.voidupdate()Main tuning loop for this param.
Constructor Details
PumperIdleLpsParam
PumperIdleLpsParam()Creates the parameter that caps the NTCP pumper idle loops per second.
Method Details
applyValue
protected void applyValue(int value) Description copied from class:Tuner.BaseParamApply the tunable value to the router configuration.- Specified by:
applyValuein classTuner.BaseParam- Parameters:
value- the tunable value to apply to router configuration
getRuntimeValue
protected int getRuntimeValue()Description copied from class:Tuner.BaseParamCurrent runtime value read from the router configuration.- Specified by:
getRuntimeValuein classTuner.BaseParam- Returns:
- current runtime value read from router config
getObservedStat
Description copied from class:Tuner.BaseParamObserved stat value used for autotuning.ctxis always this param's own context:Tunertakes a singleRouterContext, hands the same instance to everyBaseParamconstructor, and both call sites passTuner.BaseParam._ctx. It was previously passed asnull, which silently broke any implementation that used the argument instead of the field — a param reading a cross-reference stat then threw on every tuning cycle, was caught by the cycle handler, and never tuned at all, with nothing but a repeated WARN to show for it. Implementations may use eitherctxorTuner.BaseParam._ctx; both are the same object.- Specified by:
getObservedStatin classTuner.BaseParam- Parameters:
ctx- router context, never null- Returns:
- observed stat value for autotuning
computeTarget
protected int computeTarget(double observed) Description copied from class:Tuner.BaseParamTarget tunable value computed from the observed stat.- Specified by:
computeTargetin classTuner.BaseParam- Parameters:
observed- current stat value- Returns:
- target tunable value