Search in sources :

Example 1 with SpeedManagerAlgorithmProviderAdapter

use of com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter 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 2 with SpeedManagerAlgorithmProviderAdapter

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

the class SpeedLimitMonitor method guessUploadLimit.

// guessDownloadLimit
public int guessUploadLimit() {
    if (!useVariancePingMap) {
        int dmUpLimitGuess = pingMapOfDownloadMode.guessUploadLimit();
        int smUpLimitGuess = pingMapOfSeedingMode.guessUploadLimit();
        return Math.max(dmUpLimitGuess, smUpLimitGuess);
    } else {
        boolean wasChocked = true;
        SpeedManagerLimitEstimate transientEst = null;
        if (transientPingMap != null) {
            transientEst = transientPingMap.getLastBadUploadLimit();
            if (transientEst == null) {
                wasChocked = false;
                transientEst = transientPingMap.getEstimatedUploadLimit(false);
            }
        }
        // NOTE: Currently just getting the persistentMap for temp logging purposes.
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        SpeedManagerPingMapper persistentMap = adapter.getPingMapper();
        SpeedManagerLimitEstimate persistentEst = persistentMap.getEstimatedUploadLimit(false);
        // log the different ping-mappers for beta.
        betaLogPingMapperEstimates("up", transientEst, wasChocked, persistentEst, pingMapOfDownloadMode, pingMapOfSeedingMode);
        if (transientEst != null) {
            return choseBestLimit(transientEst, uploadLimitMax, uploadLimitConf);
        } else {
            return uploadLimitMax;
        }
    }
}
Also used : SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Example 3 with SpeedManagerAlgorithmProviderAdapter

use of com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter 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 4 with SpeedManagerAlgorithmProviderAdapter

use of com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter 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 5 with SpeedManagerAlgorithmProviderAdapter

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

the class SpeedLimitMonitor method isSettingDownloadUnlimited.

// logPMDataEx
/**
 * The criteria for download being unlimited is if the ConfigPanel has the
 * "download == 0 " && "type==fixed"
 * @return - true
 */
private boolean isSettingDownloadUnlimited() {
    SpeedManagerAlgorithmProviderAdapter adpter = SMInstance.getInstance().getAdapter();
    SpeedManager sm = adpter.getSpeedManager();
    SpeedManagerLimitEstimate dEst = sm.getEstimatedDownloadCapacityBytesPerSec();
    int rate = dEst.getBytesPerSec();
    float type = dEst.getEstimateType();
    // user or plug-in want the download rate unlimited.
    if (rate == 0 && type == SpeedManagerLimitEstimate.TYPE_MANUAL) {
        return true;
    }
    // start the search in unlimited mode.
    if (rate == 0 && type == SpeedManagerLimitEstimate.TYPE_UNKNOWN) {
        return true;
    }
    return false;
}
Also used : SpeedManager(com.biglybt.core.speedmanager.SpeedManager) SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)

Aggregations

SpeedManagerAlgorithmProviderAdapter (com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter)10 SpeedManagerLimitEstimate (com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)9 SpeedManagerPingMapper (com.biglybt.core.speedmanager.SpeedManagerPingMapper)5 SpeedManager (com.biglybt.core.speedmanager.SpeedManager)3 LogEvent (com.biglybt.core.logging.LogEvent)1