Search in sources :

Example 1 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class PingSpaceMon method getDownloadLimit.

/**
 * Get the current estimated download limit from the ping mapper.
 * @return - SpeedManagerLimitEstimate
 */
public static SpeedManagerLimitEstimate getDownloadLimit() {
    try {
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        SpeedManagerPingMapper persistentMap = adapter.getPingMapper();
        SpeedManagerLimitEstimate downEst = persistentMap.getEstimatedDownloadLimit(true);
        return downEst;
    } catch (Throwable t) {
        // log this event and
        SpeedManagerLogger.log(t.toString());
        t.printStackTrace();
        // something to return 0 and -1.0f results.
        return new DefaultLimitEstimate();
    }
}
Also used : SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Example 2 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class PingSpaceMon method getDownloadEstCapacity.

// getDownloadLimit
/**
 * Get the estimated download capacity from the SpeedManager.
 * @return - SpeedManagerLimitEstimate
 */
public static SpeedManagerLimitEstimate getDownloadEstCapacity() {
    try {
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        SpeedManager sm = adapter.getSpeedManager();
        SpeedManagerLimitEstimate downEstCapacity = sm.getEstimatedDownloadCapacityBytesPerSec();
        return downEstCapacity;
    } catch (Throwable t) {
        // log this event and
        SpeedManagerLogger.log(t.toString());
        t.printStackTrace();
        // something to return 0 and -1.0f results.
        return new DefaultLimitEstimate();
    }
}
Also used : SpeedManager(com.biglybt.core.speedmanager.SpeedManager) SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)

Example 3 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class SpeedLimitListener method propertyChanged.

@Override
public void propertyChanged(int property) {
    String type = "unknown";
    if (property == SpeedManagerListener.PR_ASN) {
        type = "ASN change";
        mon.readFromPersistentMap();
        mon.updateFromCOConfigManager();
        SMSearchLogger.log("ASN change.");
    } else if (property == SpeedManagerListener.PR_DOWN_CAPACITY) {
        type = "download capacity";
        SpeedManagerLimitEstimate pmEst = PingSpaceMon.getDownloadLimit();
        SpeedManagerLimitEstimate smEst = PingSpaceMon.getDownloadEstCapacity();
        SMSearchLogger.log(" download - persistent limit: " + pmEst.getString());
        SMSearchLogger.log(" download - estimated capacity: " + smEst.getString());
        mon.notifyDownload(smEst);
    } else if (property == SpeedManagerListener.PR_UP_CAPACITY) {
        type = "upload capacity";
        SpeedManagerLimitEstimate shortTermLimit = PingSpaceMon.getUploadLimit(false);
        SpeedManagerLimitEstimate pmEst = PingSpaceMon.getUploadLimit(true);
        SpeedManagerLimitEstimate smEst = PingSpaceMon.getUploadEstCapacity();
        SMSearchLogger.log(" upload - short term limit: " + shortTermLimit.getString());
        SMSearchLogger.log(" upload - persistent limit: " + pmEst.getString());
        SMSearchLogger.log(" upload - estimated capacity: " + smEst.getString());
        mon.notifyUpload(smEst);
    }
    SpeedManagerLogger.log("Updated from SpeedManagerPingMapper property=" + type);
}
Also used : SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)

Example 4 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class SpeedLimitMonitor method logPingMapData.

// hadChockingPing
/**
 * Just log this data until we decide if it is useful.
 */
public void logPingMapData() {
    if (!useVariancePingMap) {
        int downLimGuess = pingMapOfDownloadMode.guessDownloadLimit();
        int upLimGuess = pingMapOfDownloadMode.guessUploadLimit();
        int seedingUpLimGuess = pingMapOfSeedingMode.guessUploadLimit();
        StringBuilder sb = new StringBuilder("ping-map: ");
        sb.append(":down=").append(downLimGuess);
        sb.append(":up=").append(upLimGuess);
        sb.append(":(seed)up=").append(seedingUpLimGuess);
        SpeedManagerLogger.log(sb.toString());
    } else {
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        SpeedManagerPingMapper persistentMap = adapter.getPingMapper();
        SpeedManagerLimitEstimate estUp = persistentMap.getEstimatedUploadLimit(false);
        SpeedManagerLimitEstimate estDown = persistentMap.getEstimatedDownloadLimit(false);
        int downLimGuess = estDown.getBytesPerSec();
        float downConf = estDown.getMetricRating();
        int upLimGuess = estUp.getBytesPerSec();
        float upConf = estUp.getMetricRating();
        String name = persistentMap.getName();
        StringBuilder sb = new StringBuilder("new-ping-map: ");
        sb.append(" name=").append(name);
        sb.append(", down=").append(downLimGuess);
        sb.append(", down-conf=").append(downConf);
        sb.append(", up=").append(upLimGuess);
        sb.append(", up-conf=").append(upConf);
        SpeedManagerLogger.log(sb.toString());
    }
}
Also used : SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Example 5 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class SpeedLimitMonitor method readFromPersistentMap.

// updateFromCOConfigManager
/**
 * replaces - updateFromCOConfigManager()
 */
public void readFromPersistentMap() {
    // get persistent mapper.
    SpeedManager sm = CoreFactory.getSingleton().getSpeedManager();
    // get upload estimate.
    SpeedManagerLimitEstimate uEst = SMConst.filterEstimate(sm.getEstimatedUploadCapacityBytesPerSec(), SMConst.START_UPLOAD_RATE_MAX);
    int upPingMapLimit = uEst.getBytesPerSec();
    if (upPingMapLimit < SMConst.START_UPLOAD_RATE_MAX) {
        // will find upload limit via slow search.
        uploadLimitMax = SMConst.START_UPLOAD_RATE_MAX;
    } else {
        uploadLimitMax = upPingMapLimit;
    }
    uploadLimitMin = SMConst.calculateMinUpload(uploadLimitMax);
    // get download estimate.
    SpeedManagerLimitEstimate dEst = SMConst.filterEstimate(sm.getEstimatedDownloadCapacityBytesPerSec(), SMConst.START_DOWNLOAD_RATE_MAX);
    int downPingMapLimit = dEst.getBytesPerSec();
    if (isSettingDownloadUnlimited()) {
        slider.setDownloadUnlimitedMode(true);
    } else {
        slider.setDownloadUnlimitedMode(false);
    }
    if (downPingMapLimit < SMConst.START_DOWNLOAD_RATE_MAX) {
        downloadLimitMax = SMConst.START_DOWNLOAD_RATE_MAX;
    } else {
        downloadLimitMax = downPingMapLimit;
    }
    downloadLimitMin = SMConst.calculateMinDownload(downloadLimitMax);
    uploadLimitConf = SpeedLimitConfidence.convertType(uEst.getEstimateType());
    downloadLimitConf = SpeedLimitConfidence.convertType(dEst.getEstimateType());
    percentUploadCapacityDownloadMode = (float) COConfigurationManager.getIntParameter(SpeedLimitMonitor.USED_UPLOAD_CAPACITY_DOWNLOAD_MODE, 60) / 100.0f;
    saveToCOConfiguration();
}
Also used : SpeedManager(com.biglybt.core.speedmanager.SpeedManager) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)

Aggregations

SpeedManagerLimitEstimate (com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)22 SpeedManagerAlgorithmProviderAdapter (com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter)9 SpeedManagerPingMapper (com.biglybt.core.speedmanager.SpeedManagerPingMapper)7 SpeedManager (com.biglybt.core.speedmanager.SpeedManager)6 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 LogEvent (com.biglybt.core.logging.LogEvent)1 PEPeerManager (com.biglybt.core.peer.PEPeerManager)1 PEPeerManagerStats (com.biglybt.core.peer.PEPeerManagerStats)1 LimitToTextHelper (com.biglybt.core.speedmanager.LimitToTextHelper)1 SpeedManagerListener (com.biglybt.core.speedmanager.SpeedManagerListener)1 Parameter (com.biglybt.pif.ui.config.Parameter)1 TransferStatsView (com.biglybt.ui.swt.views.stats.TransferStatsView)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1