Search in sources :

Example 6 with SpeedManagerAlgorithmProviderAdapter

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

the class SpeedLimitMonitor method guessDownloadLimit.

// betaLogPingMapperEstimates
public int guessDownloadLimit() {
    if (!useVariancePingMap) {
        return pingMapOfDownloadMode.guessDownloadLimit();
    } else {
        boolean wasChocked = true;
        SpeedManagerLimitEstimate transientEst = null;
        if (transientPingMap != null) {
            transientEst = transientPingMap.getLastBadDownloadLimit();
            if (transientEst == null) {
                wasChocked = false;
                transientEst = transientPingMap.getEstimatedDownloadLimit(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.getEstimatedDownloadLimit(false);
        // log the different ping-mappers for beta.
        betaLogPingMapperEstimates("down", transientEst, wasChocked, persistentEst, pingMapOfDownloadMode, pingMapOfSeedingMode);
        if (transientEst != null) {
            return choseBestLimit(transientEst, downloadLimitMax, downloadLimitConf);
        } else {
            return downloadLimitMax;
        }
    }
}
Also used : SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Example 7 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)

Example 8 with SpeedManagerAlgorithmProviderAdapter

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

the class SpeedLimitMonitor method triggerLimitTestingFlag.

// rampTestingLimit
public void triggerLimitTestingFlag() {
    SpeedManagerLogger.trace("triggerd fast limit test.");
    beginLimitTest = true;
    // if we are using a persistent PingSource then get that here.
    if (useVariancePingMap) {
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        // start a new transientPingMap;
        if (transientPingMap != null) {
            transientPingMap.destroy();
        }
        transientPingMap = adapter.createTransientPingMapper();
    }
}
Also used : SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter)

Example 9 with SpeedManagerAlgorithmProviderAdapter

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

the class PingSpaceMon method getUploadEstCapacity.

// getUploadLimit
public static SpeedManagerLimitEstimate getUploadEstCapacity() {
    try {
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        SpeedManager sm = adapter.getSpeedManager();
        SpeedManagerLimitEstimate upEstCapacity = sm.getEstimatedUploadCapacityBytesPerSec();
        return upEstCapacity;
    } catch (Throwable t) {
        // log this event and
        SpeedManagerLogger.log(t.toString());
        t.printStackTrace();
        // something to return 1 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 10 with SpeedManagerAlgorithmProviderAdapter

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

the class PingSpaceMon method getUploadLimit.

/**
 * Get the current estimated upload limit from the ping mapper.
 * @param - true if the long-term persistent result should be used.
 * @return - SpeedManagerLimitEstimate.
 */
public static SpeedManagerLimitEstimate getUploadLimit(boolean persistent) {
    try {
        SMInstance pm = SMInstance.getInstance();
        SpeedManagerAlgorithmProviderAdapter adapter = pm.getAdapter();
        SpeedManagerPingMapper persistentMap = adapter.getPingMapper();
        SpeedManagerLimitEstimate upEst = persistentMap.getEstimatedUploadLimit(true);
        return upEst;
    } catch (Throwable t) {
        // log this event and
        SpeedManagerLogger.log(t.toString());
        t.printStackTrace();
        // something to return 1 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)

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