Search in sources :

Example 1 with DHTDBStats

use of com.biglybt.core.dht.db.DHTDBStats 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 2 with DHTDBStats

use of com.biglybt.core.dht.db.DHTDBStats 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)

Example 3 with DHTDBStats

use of com.biglybt.core.dht.db.DHTDBStats in project BiglyBT by BiglySoftware.

the class DHTView method refreshDB.

private void refreshDB() {
    if (refreshIter == 0) {
        DHTDBStats dbStats = dht.getDataBase().getStats();
        lblKeys.setText("" + dbStats.getKeyCount() + " (" + dbStats.getLocalKeyCount() + ")");
        int[] stats = dbStats.getValueDetails();
        lblValues.setText("" + stats[DHTDBStats.VD_VALUE_COUNT]);
        lblSize.setText(DisplayFormatters.formatByteCountToKiBEtc(dbStats.getSize()));
        lblDirect.setText(DisplayFormatters.formatByteCountToKiBEtc(stats[DHTDBStats.VD_DIRECT_SIZE]));
        lblIndirect.setText(DisplayFormatters.formatByteCountToKiBEtc(stats[DHTDBStats.VD_INDIRECT_SIZE]));
        lblLocal.setText(DisplayFormatters.formatByteCountToKiBEtc(stats[DHTDBStats.VD_LOCAL_SIZE]));
        DHTStorageAdapter sa = dht.getStorageAdapter();
        String rem_freq;
        String rem_size;
        if (sa == null) {
            rem_freq = "-";
            rem_size = "-";
        } else {
            rem_freq = "" + sa.getRemoteFreqDivCount();
            rem_size = "" + sa.getRemoteSizeDivCount();
        }
        lblDivFreq.setText("" + stats[DHTDBStats.VD_DIV_FREQ] + " (" + rem_freq + ")");
        lblDivSize.setText("" + stats[DHTDBStats.VD_DIV_SIZE] + " (" + rem_size + ")");
    } else {
        refreshIter++;
        if (refreshIter == 100)
            refreshIter = 0;
    }
}
Also used : DHTDBStats(com.biglybt.core.dht.db.DHTDBStats) DHTStorageAdapter(com.biglybt.core.dht.DHTStorageAdapter)

Aggregations

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