mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Remove display of data from last second
This commit is contained in:
parent
a88e8f88fa
commit
8c619530a4
3 changed files with 10 additions and 48 deletions
|
@ -1138,8 +1138,8 @@ settings.net.heightColumn=Height
|
|||
|
||||
settings.net.needRestart=You need to restart the application to apply that change.\nDo you want to do that now?
|
||||
settings.net.notKnownYet=Not known yet...
|
||||
settings.net.sentData=Sent data: {0}, {1} messages, {2} messages/sec, {3} messages sent in last second
|
||||
settings.net.receivedData=Received data: {0}, {1} messages, {2} messages/sec, {3} messages received in last second
|
||||
settings.net.sentData=Sent data: {0}, {1} messages, {2} messages/sec
|
||||
settings.net.receivedData=Received data: {0}, {1} messages, {2} messages/sec
|
||||
settings.net.ips=[IP address:port | host name:port | onion address:port] (comma separated). Port can be omitted if default is used (8333).
|
||||
settings.net.seedNode=Seed node
|
||||
settings.net.directPeer=Peer (direct)
|
||||
|
|
|
@ -304,16 +304,14 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
|
|||
sentDataTextField.textProperty().bind(createStringBinding(() -> Res.get("settings.net.sentData",
|
||||
FormattingUtils.formatBytes(Statistic.totalSentBytesProperty().get()),
|
||||
Statistic.numTotalSentMessagesProperty().get(),
|
||||
Statistic.numTotalSentMessagesPerSecProperty().get(),
|
||||
Statistic.numTotalSentMessagesLastSecProperty().get()),
|
||||
Statistic.numTotalSentMessagesLastSecProperty()));
|
||||
Statistic.numTotalSentMessagesPerSecProperty().get()),
|
||||
Statistic.numTotalSentMessagesPerSecProperty()));
|
||||
|
||||
receivedDataTextField.textProperty().bind(createStringBinding(() -> Res.get("settings.net.receivedData",
|
||||
FormattingUtils.formatBytes(Statistic.totalReceivedBytesProperty().get()),
|
||||
Statistic.numTotalReceivedMessagesProperty().get(),
|
||||
Statistic.numTotalReceivedMessagesPerSecProperty().get(),
|
||||
Statistic.numTotalReceivedMessagesLastSecProperty().get()),
|
||||
Statistic.numTotalReceivedMessagesLastSecProperty()));
|
||||
Statistic.numTotalReceivedMessagesPerSecProperty().get()),
|
||||
Statistic.numTotalReceivedMessagesPerSecProperty()));
|
||||
|
||||
bitcoinSortedList.comparatorProperty().bind(bitcoinPeersTableView.comparatorProperty());
|
||||
bitcoinPeersTableView.setItems(bitcoinSortedList);
|
||||
|
|
|
@ -50,35 +50,19 @@ public class Statistic {
|
|||
private final static LongProperty totalReceivedBytes = new SimpleLongProperty(0);
|
||||
private final static Map<String, Integer> totalReceivedMessages = new ConcurrentHashMap<>();
|
||||
private final static Map<String, Integer> totalSentMessages = new ConcurrentHashMap<>();
|
||||
private final static Map<String, Integer> totalReceivedMessagesLastSec = new ConcurrentHashMap<>();
|
||||
private final static Map<String, Integer> totalSentMessagesLastSec = new ConcurrentHashMap<>();
|
||||
private final static LongProperty numTotalSentMessages = new SimpleLongProperty(0);
|
||||
private final static LongProperty numTotalSentMessagesLastSec = new SimpleLongProperty(0);
|
||||
private final static DoubleProperty numTotalSentMessagesPerSec = new SimpleDoubleProperty(0);
|
||||
private final static LongProperty numTotalReceivedMessages = new SimpleLongProperty(0);
|
||||
private final static LongProperty numTotalReceivedMessagesLastSec = new SimpleLongProperty(0);
|
||||
private final static DoubleProperty numTotalReceivedMessagesPerSec = new SimpleDoubleProperty(0);
|
||||
private static String totalSentMessagesLastSecString;
|
||||
private static String totalReceivedMessagesLastSecString;
|
||||
|
||||
static {
|
||||
UserThread.runPeriodically(() -> {
|
||||
numTotalSentMessages.set(totalSentMessages.values().stream().mapToInt(Integer::intValue).sum());
|
||||
numTotalSentMessagesLastSec.set(totalSentMessagesLastSec.values().stream().mapToInt(Integer::intValue).sum());
|
||||
numTotalReceivedMessages.set(totalReceivedMessages.values().stream().mapToInt(Integer::intValue).sum());
|
||||
numTotalReceivedMessagesLastSec.set(totalReceivedMessagesLastSec.values().stream().mapToInt(Integer::intValue).sum());
|
||||
|
||||
long passed = (System.currentTimeMillis() - startTime) / 1000;
|
||||
numTotalSentMessagesPerSec.set(((double) numTotalSentMessages.get()) / passed);
|
||||
numTotalReceivedMessagesPerSec.set(((double) numTotalReceivedMessages.get()) / passed);
|
||||
|
||||
// We keep totalSentMessagesPerSec in a string so it is available at logging (totalSentMessagesPerSec is reset)
|
||||
totalSentMessagesLastSecString = totalSentMessagesLastSec.toString();
|
||||
totalReceivedMessagesLastSecString = totalReceivedMessagesLastSec.toString();
|
||||
|
||||
// We do not clear the map as the totalSentMessagesPerSec is not thread safe and clearing could lead to null pointers
|
||||
totalSentMessagesLastSec.entrySet().forEach(e -> e.setValue(0));
|
||||
totalReceivedMessagesLastSec.entrySet().forEach(e -> e.setValue(0));
|
||||
}, 1);
|
||||
|
||||
// We log statistics every minute
|
||||
|
@ -86,16 +70,16 @@ public class Statistic {
|
|||
log.info("Network statistics:\n" +
|
||||
"Bytes sent: {} kb;\n" +
|
||||
"Number of sent messages/Sent messages: {} / {};\n" +
|
||||
"Number of sent messages of last sec/Sent messages of last sec: {} / {};\n" +
|
||||
"Number of sent messages per sec: {};\n" +
|
||||
"Bytes received: {} kb\n" +
|
||||
"Number of received messages/Received messages: {} / {};\n" +
|
||||
"Number of received messages of last sec/Received messages of last sec: {} / {};",
|
||||
"Number of received messages per sec: {};",
|
||||
totalSentBytes.get() / 1024d,
|
||||
numTotalSentMessages.get(), totalSentMessages,
|
||||
numTotalSentMessagesLastSec.get(), totalSentMessagesLastSecString,
|
||||
numTotalSentMessagesPerSec.get(),
|
||||
totalReceivedBytes.get() / 1024d,
|
||||
numTotalReceivedMessages.get(), totalReceivedMessages,
|
||||
numTotalReceivedMessagesLastSec.get(), totalReceivedMessagesLastSecString);
|
||||
numTotalReceivedMessagesPerSec.get());
|
||||
}, 60);
|
||||
}
|
||||
|
||||
|
@ -111,10 +95,6 @@ public class Statistic {
|
|||
return numTotalSentMessages;
|
||||
}
|
||||
|
||||
public static LongProperty numTotalSentMessagesLastSecProperty() {
|
||||
return numTotalSentMessagesLastSec;
|
||||
}
|
||||
|
||||
public static DoubleProperty numTotalSentMessagesPerSecProperty() {
|
||||
return numTotalSentMessagesPerSec;
|
||||
}
|
||||
|
@ -123,10 +103,6 @@ public class Statistic {
|
|||
return numTotalReceivedMessages;
|
||||
}
|
||||
|
||||
public static LongProperty numTotalReceivedMessagesLastSecProperty() {
|
||||
return numTotalReceivedMessagesLastSec;
|
||||
}
|
||||
|
||||
public static DoubleProperty numTotalReceivedMessagesPerSecProperty() {
|
||||
return numTotalReceivedMessagesPerSec;
|
||||
}
|
||||
|
@ -189,12 +165,6 @@ public class Statistic {
|
|||
counter = totalReceivedMessages.get(messageClassName) + 1;
|
||||
}
|
||||
totalReceivedMessages.put(messageClassName, counter);
|
||||
|
||||
counter = 1;
|
||||
if (totalReceivedMessagesLastSec.containsKey(messageClassName)) {
|
||||
counter = totalReceivedMessagesLastSec.get(messageClassName) + 1;
|
||||
}
|
||||
totalReceivedMessagesLastSec.put(messageClassName, counter);
|
||||
}
|
||||
|
||||
void addSentMessage(NetworkEnvelope networkEnvelope) {
|
||||
|
@ -210,12 +180,6 @@ public class Statistic {
|
|||
counter = totalSentMessages.get(messageClassName) + 1;
|
||||
}
|
||||
totalSentMessages.put(messageClassName, counter);
|
||||
|
||||
counter = 1;
|
||||
if (totalSentMessagesLastSec.containsKey(messageClassName)) {
|
||||
counter = totalSentMessagesLastSec.get(messageClassName) + 1;
|
||||
}
|
||||
totalSentMessagesLastSec.put(messageClassName, counter);
|
||||
}
|
||||
|
||||
public void setRoundTripTime(int roundTripTime) {
|
||||
|
|
Loading…
Add table
Reference in a new issue