Skip to content

Commit f152e5b

Browse files
committed
Reduce start/stop rules debug log
1 parent 45f434d commit f152e5b

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

core/src/com/biglybt/plugin/startstoprules/defaultplugin/StartStopRulesDefaultPlugin.java

+29-14
Original file line numberDiff line numberDiff line change
@@ -1624,21 +1624,30 @@ private static class
16241624

16251625
private long processMaxMS = 0;
16261626

1627-
private long processLastComplete = 0;
1627+
private long processLastCompleteMono = -1;
16281628

16291629
private long processTotalGap = 0;
16301630

16311631
private long processTotalRecalcs = 0;
16321632

16331633
private long processTotalZeroRecalcs = 0;
16341634

1635+
private long lastDebugNoChangesMono = -1;
1636+
16351637
protected void process() {
1636-
long now = 0;
1638+
long nowMono = -1;
16371639
try {
16381640
this_mon.enter();
16391641

1640-
now = SystemTime.getCurrentTime();
1642+
nowMono = SystemTime.getMonotonousTime();
16411643

1644+
boolean debugNoChange = lastDebugNoChangesMono == -1 || nowMono - lastDebugNoChangesMono >= 60000;
1645+
1646+
if ( debugNoChange ){
1647+
1648+
lastDebugNoChangesMono = nowMono;
1649+
}
1650+
16421651
somethingChanged = false;
16431652
Object[] recalcArray;
16441653
try {
@@ -1653,10 +1662,15 @@ protected void process() {
16531662
DefaultRankCalculator rankObj = (DefaultRankCalculator) recalcArray[i];
16541663
if (bDebugLog) {
16551664
long oldSR = rankObj.getSeedingRank();
1665+
16561666
rankObj.recalcSeedingRank();
1657-
String s = "recalc seeding rank. old/new=" + oldSR + "/"
1658-
+ rankObj.getSeedingRank();
1659-
log.log(rankObj.getRelatedTo(), LoggerChannel.LT_INFORMATION, s);
1667+
1668+
int newSR=rankObj.getSeedingRank();
1669+
1670+
if ( oldSR != newSR ){
1671+
String s = "recalc seeding rank. old/new=" + oldSR + "/" + newSR;
1672+
log.log(rankObj.getRelatedTo(), LoggerChannel.LT_INFORMATION, s);
1673+
}
16601674
} else {
16611675
rankObj.recalcSeedingRank();
16621676
}
@@ -1939,7 +1953,7 @@ protected void process() {
19391953
tvars = temp.toArray(new ProcessTagVarsComplete[temp.size()]);
19401954
}
19411955

1942-
handleCompletedDownload( dlData, vars, tvars, totals);
1956+
handleCompletedDownload( dlData, vars, tvars, totals, debugNoChange );
19431957
}
19441958
} // Loop 2/2 (Start/Stopping)
19451959

@@ -2024,20 +2038,20 @@ protected void process() {
20242038
"freeS=" + lightSeedingSlots, "", true, null);
20252039
}
20262040
} finally {
2027-
if (now > 0) {
2041+
if (nowMono >= 0) {
20282042
processCount++;
2029-
long timeTaken = (SystemTime.getCurrentTime() - now);
2043+
long timeTaken = (SystemTime.getMonotonousTime() - nowMono);
20302044
if (bDebugLog) {
20312045
log.log(LoggerChannel.LT_INFORMATION, "process() took " + timeTaken);
20322046
}
20332047
processTotalMS += timeTaken;
20342048
if (timeTaken > processMaxMS) {
20352049
processMaxMS = timeTaken;
20362050
}
2037-
if (processLastComplete > 0) {
2038-
processTotalGap += (now - processLastComplete);
2051+
if (processLastCompleteMono >= 0) {
2052+
processTotalGap += (nowMono - processLastCompleteMono);
20392053
}
2040-
processLastComplete = now;
2054+
processLastCompleteMono = nowMono;
20412055
}
20422056

20432057
immediateProcessingScheduled = false;
@@ -2805,7 +2819,8 @@ protected void process() {
28052819
DefaultRankCalculator dlData,
28062820
ProcessVars vars,
28072821
ProcessTagVarsComplete[] tagVars,
2808-
TotalsStats totals )
2822+
TotalsStats totals,
2823+
boolean debugNoChange )
28092824
{
28102825
if (!totals.bOkToStartSeeding)
28112826
return;
@@ -3449,7 +3464,7 @@ else if (!bActivelySeeding && bSeeding)
34493464
"nSeeds=" + dlData.getLastModifiedScrapeResultSeeds(),
34503465
"nPeers=" + dlData.getLastModifiedScrapeResultPeers()
34513466
};
3452-
printDebugChanges("", debugEntries, debugEntries2, sDebugLine, " ", true, dlData);
3467+
printDebugChanges("", debugEntries, debugEntries2, sDebugLine, " ", debugNoChange, dlData);
34533468
}
34543469
}
34553470
}

0 commit comments

Comments
 (0)