use of com.biglybt.core.dht.transport.DHTTransportStats in project BiglyBT by BiglySoftware.
the class DHTView method refreshGeneral.
private void refreshGeneral() {
DHTControlStats controlStats = dht.getControl().getStats();
DHTRouterStats routerStats = dht.getRouter().getStats();
DHTTransport transport = dht.getTransport();
DHTTransportStats transportStats = transport.getStats();
lblUpTime.setText(TimeFormatter.format(controlStats.getRouterUptime() / 1000));
lblNumberOfUsers.setText("" + controlStats.getEstimatedDHTSize());
int percent = transportStats.getRouteablePercentage();
lblReachable.setText((transport.isReachable() ? yes_str : no_str) + (percent == -1 ? "" : (" " + percent + "%")));
DHTNATPuncher puncher = dht.getNATPuncher();
String puncher_str;
if (puncher == null) {
puncher_str = "";
} else {
puncher_str = puncher.operational() ? yes_str : no_str;
}
lblRendezvous.setText(transport.isReachable() ? "" : puncher_str);
long[] stats = routerStats.getStats();
lblNodes.setText("" + stats[DHTRouterStats.ST_NODES]);
lblLeaves.setText("" + stats[DHTRouterStats.ST_LEAVES]);
lblContacts.setText("" + stats[DHTRouterStats.ST_CONTACTS]);
lblReplacements.setText("" + stats[DHTRouterStats.ST_REPLACEMENTS]);
lblLive.setText("" + stats[DHTRouterStats.ST_CONTACTS_LIVE]);
lblUnknown.setText("" + stats[DHTRouterStats.ST_CONTACTS_UNKNOWN]);
lblDying.setText("" + stats[DHTRouterStats.ST_CONTACTS_DEAD]);
long skew_average = transportStats.getSkewAverage();
lblSkew.setText(skew_average == 0 ? "" : (skew_average < 0 ? "-" : "") + TimeFormatter.format100ths(Math.abs(skew_average)));
}
use of com.biglybt.core.dht.transport.DHTTransportStats in project BiglyBT by BiglySoftware.
the class DHTView method periodicUpdate.
public void periodicUpdate() {
if (dht == null)
return;
DHTTransportFullStats fullStats = dht.getTransport().getLocalContact().getStats();
if (fullStats != null) {
inGraph.addIntValue((int) fullStats.getAverageBytesReceived());
outGraph.addIntValue((int) fullStats.getAverageBytesSent());
}
DHTTransportStats stats = dht.getTransport().getStats();
int[] rtts = stats.getRTTHistory().clone();
Arrays.sort(rtts);
int rtt_total = 0;
int rtt_num = 0;
int start = 0;
for (int rtt : rtts) {
if (rtt > 0) {
rtt_total += rtt;
rtt_num++;
} else {
start++;
}
}
int average = 0;
int best = 0;
int worst = 0;
if (rtt_num > 0) {
average = rtt_total / rtt_num;
}
int chunk = rtt_num / 3;
int max_best = start + chunk;
int min_worst = rtts.length - 1 - chunk;
int worst_total = 0;
int worst_num = 0;
int best_total = 0;
int best_num = 0;
for (int i = start; i < rtts.length; i++) {
if (i < max_best) {
best_total += rtts[i];
best_num++;
} else if (i > min_worst) {
worst_total += rtts[i];
worst_num++;
}
}
if (best_num > 0) {
best = best_total / best_num;
}
if (worst_num > 0) {
worst = worst_total / worst_num;
}
rttGraph.addIntsValue(new int[] { average, best, worst });
}
use of com.biglybt.core.dht.transport.DHTTransportStats in project BiglyBT by BiglySoftware.
the class DHTView method refreshOperationDetails.
private void refreshOperationDetails() {
DHTTransportStats transportStats = dht.getTransport().getStats();
long[] pings = transportStats.getPings();
for (int i = 0; i < 4; i++) {
lblPings[i].setText("" + pings[i]);
}
long[] findNodes = transportStats.getFindNodes();
for (int i = 0; i < 4; i++) {
lblFindNodes[i].setText("" + findNodes[i]);
}
long[] findValues = transportStats.getFindValues();
for (int i = 0; i < 4; i++) {
lblFindValues[i].setText("" + findValues[i]);
}
long[] stores = transportStats.getStores();
long[] qstores = transportStats.getQueryStores();
for (int i = 0; i < 4; i++) {
lblStores[i].setText("" + stores[i] + " (" + qstores[i] + ")");
}
long[] data = transportStats.getData();
for (int i = 0; i < 4; i++) {
lblData[i].setText("" + data[i]);
}
}
use of com.biglybt.core.dht.transport.DHTTransportStats in project BiglyBT by BiglySoftware.
the class LongTermStatsImpl method updateStats.
private void updateStats(int record_type) {
long current_d_received = gm_stats.getTotalDataBytesReceived();
long current_p_received = gm_stats.getTotalProtocolBytesReceived();
long current_d_sent = gm_stats.getTotalDataBytesSent();
long current_p_sent = gm_stats.getTotalProtocolBytesSent();
long current_dht_sent = 0;
long current_dht_received = 0;
DHT[] dhts = getDHTs();
if (dhts != null) {
for (DHT dht : dhts) {
DHTTransportStats dht_stats = dht.getTransport().getStats();
current_dht_sent += dht_stats.getBytesSent();
current_dht_received += dht_stats.getBytesReceived();
}
}
write(record_type, new long[] { (current_p_sent - ss_p_sent), (current_d_sent - ss_d_sent), (current_p_received - ss_p_received), (current_d_received - ss_d_received), (current_dht_sent - ss_dht_sent), (current_dht_received - ss_dht_received) });
}
use of com.biglybt.core.dht.transport.DHTTransportStats in project BiglyBT by BiglySoftware.
the class DHTControlStatsImpl method update.
protected void update() {
DHTTransport transport = control.getTransport();
DHTTransportStats t_stats = transport.getStats().snapshot();
packets_in_average.addValue(t_stats.getPacketsReceived() - transport_snapshot.getPacketsReceived());
packets_out_average.addValue(t_stats.getPacketsSent() - transport_snapshot.getPacketsSent());
bytes_in_average.addValue(t_stats.getBytesReceived() - transport_snapshot.getBytesReceived());
bytes_out_average.addValue(t_stats.getBytesSent() - transport_snapshot.getBytesSent());
transport_snapshot = t_stats;
router_snapshot = control.getRouter().getStats().getStats();
value_details_snapshot = null;
}
Aggregations