Search in sources :

Example 1 with DHTControlStats

use of com.biglybt.core.dht.control.DHTControlStats 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 DHTControlStats

use of com.biglybt.core.dht.control.DHTControlStats in project BiglyBT by BiglySoftware.

the class Show method showDHTStats.

protected void showDHTStats(ConsoleInput ci) {
    try {
        PluginInterface def = ci.core.getPluginManager().getDefaultPluginInterface();
        PluginInterface dht_pi = def.getPluginManager().getPluginInterfaceByClass(DHTPlugin.class);
        if (dht_pi == null) {
            ci.out.println("\tDHT isn't present");
            return;
        }
        DHTPlugin dht_plugin = (DHTPlugin) dht_pi.getPlugin();
        if (dht_plugin.getStatus() != DHTPlugin.STATUS_RUNNING) {
            ci.out.println("\tDHT isn't running yet (disabled or initialising)");
            return;
        }
        DHT[] dhts = dht_plugin.getDHTs();
        for (int i = 0; i < dhts.length; i++) {
            if (i > 0) {
                ci.out.println("");
            }
            DHT dht = dhts[i];
            DHTTransport transport = dht.getTransport();
            DHTTransportStats t_stats = transport.getStats();
            DHTDBStats d_stats = dht.getDataBase().getStats();
            DHTControlStats c_stats = dht.getControl().getStats();
            DHTRouterStats r_stats = dht.getRouter().getStats();
            long[] rs = r_stats.getStats();
            DHTNetworkPosition[] nps = transport.getLocalContact().getNetworkPositions();
            String np_str = "";
            for (int j = 0; j < nps.length; j++) {
                np_str += (j == 0 ? "" : ",") + nps[j];
            }
            ci.out.println("DHT:ip=" + transport.getLocalContact().getAddress() + ",net=" + transport.getNetwork() + ",prot=V" + transport.getProtocolVersion() + ",np=" + np_str + ",sleeping=" + dht.isSleeping());
            ci.out.println("Router" + ":nodes=" + rs[DHTRouterStats.ST_NODES] + ",leaves=" + rs[DHTRouterStats.ST_LEAVES] + ",contacts=" + rs[DHTRouterStats.ST_CONTACTS] + ",replacement=" + rs[DHTRouterStats.ST_REPLACEMENTS] + ",live=" + rs[DHTRouterStats.ST_CONTACTS_LIVE] + ",unknown=" + rs[DHTRouterStats.ST_CONTACTS_UNKNOWN] + ",failing=" + rs[DHTRouterStats.ST_CONTACTS_DEAD]);
            ci.out.println("Transport" + ":" + t_stats.getString());
            int[] dbv_details = d_stats.getValueDetails();
            ci.out.println("Control:dht=" + c_stats.getEstimatedDHTSize() + ", Database:keys=" + d_stats.getKeyCount() + ",vals=" + dbv_details[DHTDBStats.VD_VALUE_COUNT] + ",loc=" + dbv_details[DHTDBStats.VD_LOCAL_SIZE] + ",dir=" + dbv_details[DHTDBStats.VD_DIRECT_SIZE] + ",ind=" + dbv_details[DHTDBStats.VD_INDIRECT_SIZE] + ",div_f=" + dbv_details[DHTDBStats.VD_DIV_FREQ] + ",div_s=" + dbv_details[DHTDBStats.VD_DIV_SIZE]);
            dht.getRouter().print();
        }
    } catch (Throwable e) {
        e.printStackTrace(ci.out);
    }
}
Also used : DHTDBStats(com.biglybt.core.dht.db.DHTDBStats) PluginInterface(com.biglybt.pif.PluginInterface) DHT(com.biglybt.core.dht.DHT) DHTNetworkPosition(com.biglybt.core.dht.netcoords.DHTNetworkPosition) DHTPlugin(com.biglybt.plugin.dht.DHTPlugin) DHTRouterStats(com.biglybt.core.dht.router.DHTRouterStats) DHTControlStats(com.biglybt.core.dht.control.DHTControlStats)

Example 3 with DHTControlStats

use of com.biglybt.core.dht.control.DHTControlStats in project BiglyBT by BiglySoftware.

the class DHTPluginImpl method logStats.

public void logStats() {
    DHTDBStats d_stats = dht.getDataBase().getStats();
    DHTControlStats c_stats = dht.getControl().getStats();
    DHTRouterStats r_stats = dht.getRouter().getStats();
    DHTTransportStats t_stats = transport.getStats();
    long[] rs = r_stats.getStats();
    log.log("DHT:ip=" + transport.getLocalContact().getAddress() + ",net=" + transport.getNetwork() + ",prot=V" + transport.getProtocolVersion() + ",reach=" + transport.isReachable() + ",flags=" + Integer.toString((int) (transport.getGenericFlags() & 0xff), 16));
    log.log("Router" + ":nodes=" + rs[DHTRouterStats.ST_NODES] + ",leaves=" + rs[DHTRouterStats.ST_LEAVES] + ",contacts=" + rs[DHTRouterStats.ST_CONTACTS] + ",replacement=" + rs[DHTRouterStats.ST_REPLACEMENTS] + ",live=" + rs[DHTRouterStats.ST_CONTACTS_LIVE] + ",unknown=" + rs[DHTRouterStats.ST_CONTACTS_UNKNOWN] + ",failing=" + rs[DHTRouterStats.ST_CONTACTS_DEAD]);
    log.log("Transport" + ":" + t_stats.getString());
    int[] dbv_details = d_stats.getValueDetails();
    log.log("Control:dht=" + c_stats.getEstimatedDHTSize() + ", Database:keys=" + d_stats.getKeyCount() + ",vals=" + dbv_details[DHTDBStats.VD_VALUE_COUNT] + ",loc=" + dbv_details[DHTDBStats.VD_LOCAL_SIZE] + ",dir=" + dbv_details[DHTDBStats.VD_DIRECT_SIZE] + ",ind=" + dbv_details[DHTDBStats.VD_INDIRECT_SIZE] + ",div_f=" + dbv_details[DHTDBStats.VD_DIV_FREQ] + ",div_s=" + dbv_details[DHTDBStats.VD_DIV_SIZE]);
    DHTNATPuncher np = dht.getNATPuncher();
    if (np != null) {
        log.log("NAT: " + np.getStats());
    }
}
Also used : DHTDBStats(com.biglybt.core.dht.db.DHTDBStats) DHTNATPuncher(com.biglybt.core.dht.nat.DHTNATPuncher) DHTRouterStats(com.biglybt.core.dht.router.DHTRouterStats) DHTControlStats(com.biglybt.core.dht.control.DHTControlStats)

Aggregations

DHTControlStats (com.biglybt.core.dht.control.DHTControlStats)3 DHTRouterStats (com.biglybt.core.dht.router.DHTRouterStats)3 DHTDBStats (com.biglybt.core.dht.db.DHTDBStats)2 DHTNATPuncher (com.biglybt.core.dht.nat.DHTNATPuncher)2 DHT (com.biglybt.core.dht.DHT)1 DHTNetworkPosition (com.biglybt.core.dht.netcoords.DHTNetworkPosition)1 DHTTransport (com.biglybt.core.dht.transport.DHTTransport)1 DHTTransportStats (com.biglybt.core.dht.transport.DHTTransportStats)1 PluginInterface (com.biglybt.pif.PluginInterface)1 DHTPlugin (com.biglybt.plugin.dht.DHTPlugin)1