Search in sources :

Example 1 with DHTTransportStats

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)));
}
Also used : DHTNATPuncher(com.biglybt.core.dht.nat.DHTNATPuncher) DHTTransport(com.biglybt.core.dht.transport.DHTTransport) DHTRouterStats(com.biglybt.core.dht.router.DHTRouterStats) DHTControlStats(com.biglybt.core.dht.control.DHTControlStats) DHTTransportStats(com.biglybt.core.dht.transport.DHTTransportStats)

Example 2 with DHTTransportStats

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 });
}
Also used : DHTTransportFullStats(com.biglybt.core.dht.transport.DHTTransportFullStats) DHTTransportStats(com.biglybt.core.dht.transport.DHTTransportStats)

Example 3 with DHTTransportStats

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]);
    }
}
Also used : DHTTransportStats(com.biglybt.core.dht.transport.DHTTransportStats)

Example 4 with DHTTransportStats

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) });
}
Also used : DHT(com.biglybt.core.dht.DHT) DHTTransportStats(com.biglybt.core.dht.transport.DHTTransportStats)

Example 5 with DHTTransportStats

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;
}
Also used : DHTTransport(com.biglybt.core.dht.transport.DHTTransport) DHTTransportStats(com.biglybt.core.dht.transport.DHTTransportStats)

Aggregations

DHTTransportStats (com.biglybt.core.dht.transport.DHTTransportStats)8 DHT (com.biglybt.core.dht.DHT)3 DHTTransport (com.biglybt.core.dht.transport.DHTTransport)2 DHTControlStats (com.biglybt.core.dht.control.DHTControlStats)1 DHTNATPuncher (com.biglybt.core.dht.nat.DHTNATPuncher)1 DHTRouterStats (com.biglybt.core.dht.router.DHTRouterStats)1 DHTTransportFullStats (com.biglybt.core.dht.transport.DHTTransportFullStats)1 PluginInterface (com.biglybt.pif.PluginInterface)1 PluginManager (com.biglybt.pif.PluginManager)1 DHTPlugin (com.biglybt.plugin.dht.DHTPlugin)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1