Skip to content

Commit

Permalink
Statistics logging changes
Browse files Browse the repository at this point in the history
Add thread count to periodic logged statistics
Increase the statistic logging interval from 5 minutes to 1 hour
  • Loading branch information
jmacxx committed Dec 23, 2021
1 parent 9378fe4 commit 0b66fdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions p2p/src/main/java/bisq/network/p2p/network/Statistic.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class Statistic {
totalReceivedBytesPerSec.set(((double) totalReceivedBytes.get()) / passed);
}, 1);

// We log statistics every 5 minutes
// We log statistics every 60 minutes
UserThread.runPeriodically(() -> {
String ls = System.lineSeparator();
log.info("Accumulated network statistics:" + ls +
Expand All @@ -81,14 +81,16 @@ public class Statistic {
"Number of sent messages per sec: {};" + ls +
"Bytes received: {}" + ls +
"Number of received messages/Received messages: {} / {};" + ls +
"Number of received messages per sec: {};" + ls,
"Number of received messages per sec: {};" + ls +
"Number of threads: {}" + ls,
Utilities.readableFileSize(totalSentBytes.get()),
numTotalSentMessages.get(), totalSentMessages,
numTotalSentMessagesPerSec.get(),
Utilities.readableFileSize(totalReceivedBytes.get()),
numTotalReceivedMessages.get(), totalReceivedMessages,
numTotalReceivedMessagesPerSec.get());
}, TimeUnit.MINUTES.toSeconds(5));
numTotalReceivedMessagesPerSec.get(),
Thread.getAllStackTraces().keySet().size());
}, TimeUnit.MINUTES.toSeconds(60));
}

public static LongProperty totalSentBytesProperty() {
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/main/java/bisq/network/p2p/peers/PeerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void onAwakeFromStandby(long missedMs) {
};
clockWatcher.addListener(clockWatcherListener);

printStatisticsTimer = UserThread.runPeriodically(this::printStatistics, TimeUnit.MINUTES.toSeconds(5));
printStatisticsTimer = UserThread.runPeriodically(this::printStatistics, TimeUnit.MINUTES.toSeconds(60));
}

public void shutDown() {
Expand Down

0 comments on commit 0b66fdc

Please sign in to comment.