Use readableFileSize instead of division by 1024 for kb display in statistic logs

This commit is contained in:
chimp1984 2021-01-24 20:41:54 -05:00
parent db86b89377
commit fcaad5580b
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3

View File

@ -19,6 +19,7 @@ package bisq.network.p2p.network;
import bisq.common.UserThread;
import bisq.common.proto.network.NetworkEnvelope;
import bisq.common.util.Utilities;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
@ -75,16 +76,16 @@ public class Statistic {
UserThread.runPeriodically(() -> {
String ls = System.lineSeparator();
log.info("Accumulated network statistics:" + ls +
"Bytes sent: {} kb;" + ls +
"Bytes sent: {};" + ls +
"Number of sent messages/Sent messages: {} / {};" + ls +
"Number of sent messages per sec: {};" + ls +
"Bytes received: {} kb" + ls +
"Bytes received: {}" + ls +
"Number of received messages/Received messages: {} / {};" + ls +
"Number of received messages per sec: {};" + ls,
totalSentBytes.get() / 1024d,
Utilities.readableFileSize(totalSentBytes.get()),
numTotalSentMessages.get(), totalSentMessages,
numTotalSentMessagesPerSec.get(),
totalReceivedBytes.get() / 1024d,
Utilities.readableFileSize(totalReceivedBytes.get()),
numTotalReceivedMessages.get(), totalReceivedMessages,
numTotalReceivedMessagesPerSec.get());
}, TimeUnit.MINUTES.toSeconds(5));