use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.
the class SpeedLimitMonitor method logPMDataEx.
// logPMData
public void logPMDataEx() {
int tuploadLimitMax = COConfigurationManager.getIntParameter(SpeedManagerAlgorithmProviderV2.SETTING_UPLOAD_MAX_LIMIT);
int tdownloadLimitMax = COConfigurationManager.getIntParameter(SpeedManagerAlgorithmProviderV2.SETTING_DOWNLOAD_MAX_LIMIT);
// for testing.
SpeedManager sm = CoreFactory.getSingleton().getSpeedManager();
SpeedManagerLimitEstimate dEst = sm.getEstimatedDownloadCapacityBytesPerSec();
int tmpDMax = dEst.getBytesPerSec();
float tmpDMaxConf = dEst.getEstimateType();
// for testing.
SpeedManagerLimitEstimate uEst = sm.getEstimatedUploadCapacityBytesPerSec();
int tmpUMax = uEst.getBytesPerSec();
float tmpUMaxConf = uEst.getEstimateType();
SpeedLimitConfidence tuploadLimitConf = SpeedLimitConfidence.parseString(COConfigurationManager.getStringParameter(SpeedLimitMonitor.UPLOAD_CONF_LIMIT_SETTING));
SpeedLimitConfidence tdownloadLimitConf = SpeedLimitConfidence.parseString(COConfigurationManager.getStringParameter(SpeedLimitMonitor.DOWNLOAD_CONF_LIMIT_SETTING));
//
logPMData(tuploadLimitMax, tuploadLimitConf, tmpUMax, tmpUMaxConf, "check-upload");
logPMData(tdownloadLimitMax, tdownloadLimitConf, tmpDMax, tmpDMaxConf, "check-download");
}
use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate 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;
}
}
}
use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.
the class ConfigSectionTransferAutoSpeedSelect method build.
@Override
public void build() {
sm = CoreFactory.getSingleton().getSpeedManager();
if (sm == null) {
return;
}
// V1, V2 ... drop down.
// enable auto-speed beta
// /////////////////////////////////
// AutoSpeed Beta mode group
// /////////////////////////////////
// Beta-mode grouping.
// Need a drop down to select which method will be used.
String AutoSpeedClassic = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.classic");
String AutoSpeedBeta = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.beta");
String[] modeNames = { AutoSpeedClassic, AutoSpeedBeta };
int[] modes = { 1, 2 };
IntListParameterImpl versionList = new IntListParameterImpl(SpeedManagerImpl.CONFIG_VERSION, "ConfigTransferAutoSpeed.algorithm", modes, modeNames);
add(versionList);
BooleanParameterImpl enableAutoSpeed = new BooleanParameterImpl(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, "ConfigView.section.transfer.autospeed.enableauto");
add(enableAutoSpeed);
// AutoSpeed while seeding enabled.
BooleanParameterImpl enableAutoSpeedWhileSeeding = new BooleanParameterImpl("Auto Upload Speed Seeding Enabled", "ConfigView.section.transfer.autospeed.enableautoseeding");
add(enableAutoSpeedWhileSeeding);
enableAutoSpeed.addDisabledOnSelection(enableAutoSpeedWhileSeeding);
add("TASS.pgSelector", new ParameterGroupImpl("ConfigTransferAutoSpeed.algorithm.selector", enableAutoSpeed, enableAutoSpeedWhileSeeding, versionList));
// NETWORK GROUP
List<Parameter> listNetwork = new ArrayList<>();
LimitToTextHelper limit_to_text = new LimitToTextHelper();
// asn
InfoParameterImpl paramASN = new InfoParameterImpl(null, "SpeedView.stats.asn", sm.getASN());
add(paramASN, listNetwork);
// up cap
InfoParameterImpl paramEstUp = new InfoParameterImpl(null, "SpeedView.stats.estupcap", limit_to_text.getLimitText(sm.getEstimatedUploadCapacityBytesPerSec()));
add(paramEstUp, listNetwork);
// down cap
InfoParameterImpl paramEstDown = new InfoParameterImpl(null, "SpeedView.stats.estdowncap", limit_to_text.getLimitText(sm.getEstimatedDownloadCapacityBytesPerSec()));
add(paramEstDown, listNetwork);
// space
add("s0", new LabelParameterImpl(""), listNetwork);
// info
LabelParameterImpl info_label = new LabelParameterImpl("");
add("tass.info", info_label, listNetwork);
info_label.setLabelText(MessageText.getString("ConfigView.section.transfer.autospeed.network.info", new String[] { DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB) }));
// up set
String co_up = "AutoSpeed Network Upload Speed (temp)";
String co_up_type = "AutoSpeed Network Upload Speed Type (temp)";
int kinb = DisplayFormatters.getKinB();
SpeedManagerLimitEstimate up_lim = sm.getEstimatedUploadCapacityBytesPerSec();
COConfigurationManager.setParameter(co_up, up_lim.getBytesPerSec() / kinb);
COConfigurationManager.setParameter(co_up_type, limit_to_text.getSettableType(up_lim));
final IntParameterImpl max_upload = new IntParameterImpl(co_up, "SpeedView.stats.estupcap");
add(max_upload);
StringListParameterImpl max_upload_type = new StringListParameterImpl(co_up_type, null, limit_to_text.getSettableTypes(), limit_to_text.getSettableTypes());
add(max_upload_type);
max_upload_type.setLabelText(getMBitLimit(limit_to_text, (up_lim.getBytesPerSec() / kinb) * kinb));
max_upload_type.addListener(p -> {
float type = limit_to_text.textToType(max_upload_type.getValue());
SpeedManagerLimitEstimate existing = sm.getEstimatedUploadCapacityBytesPerSec();
if (existing.getEstimateType() != type) {
sm.setEstimatedUploadCapacityBytesPerSec(existing.getBytesPerSec(), type);
}
});
max_upload.addListener(p -> {
int value = max_upload.getValue() * kinb;
SpeedManagerLimitEstimate existing = sm.getEstimatedUploadCapacityBytesPerSec();
if (existing.getBytesPerSec() != value) {
sm.setEstimatedUploadCapacityBytesPerSec(value, existing.getEstimateType());
}
});
// down set
SpeedManagerLimitEstimate down_lim = sm.getEstimatedDownloadCapacityBytesPerSec();
String co_down = "AutoSpeed Network Download Speed (temp)";
String co_down_type = "AutoSpeed Network Download Speed Type (temp)";
COConfigurationManager.setParameter(co_down, down_lim.getBytesPerSec() / kinb);
COConfigurationManager.setParameter(co_down_type, limit_to_text.getSettableType(down_lim));
IntParameterImpl max_download = new IntParameterImpl(co_down, "SpeedView.stats.estdowncap");
add(max_download);
StringListParameterImpl max_download_type = new StringListParameterImpl(co_down_type, null, limit_to_text.getSettableTypes(), limit_to_text.getSettableTypes());
add(max_download_type);
max_download_type.setLabelText(getMBitLimit(limit_to_text, (down_lim.getBytesPerSec() / kinb) * kinb));
max_download_type.addListener(p -> {
float type = limit_to_text.textToType(max_download_type.getValue());
SpeedManagerLimitEstimate existing = sm.getEstimatedDownloadCapacityBytesPerSec();
if (existing.getEstimateType() != type) {
sm.setEstimatedDownloadCapacityBytesPerSec(existing.getBytesPerSec(), type);
}
});
max_download.addListener(p -> {
int value = max_download.getValue() * kinb;
SpeedManagerLimitEstimate existing = sm.getEstimatedDownloadCapacityBytesPerSec();
if (existing.getBytesPerSec() != value) {
sm.setEstimatedDownloadCapacityBytesPerSec(value, existing.getEstimateType());
}
});
ParameterGroupImpl pgNetworkLimits = new ParameterGroupImpl(null, max_download, max_download_type, max_upload, max_upload_type).setNumberOfColumns2(2);
add("TASS.pgNetworkLimits", pgNetworkLimits, listNetwork);
pgNetworkLimits.setIndent(1, false);
// reset
ActionParameterImpl reset_button = new ActionParameterImpl("ConfigView.section.transfer.autospeed.resetnetwork", "ConfigView.section.transfer.autospeed.reset.button");
add(reset_button, listNetwork);
reset_button.addListener(param -> sm.reset());
smListener = property -> {
if (property == SpeedManagerListener.PR_ASN) {
paramASN.setValue(sm.getASN());
} else if (property == SpeedManagerListener.PR_UP_CAPACITY) {
SpeedManagerLimitEstimate limit = sm.getEstimatedUploadCapacityBytesPerSec();
paramEstUp.setValue(limit_to_text.getLimitText(limit));
max_upload_type.setLabelText(getMBitLimit(limit_to_text, limit.getBytesPerSec()));
max_upload.setValue(limit.getBytesPerSec() / kinb);
max_upload_type.setValue(limit_to_text.getSettableType(limit));
} else if (property == SpeedManagerListener.PR_DOWN_CAPACITY) {
SpeedManagerLimitEstimate limit = sm.getEstimatedDownloadCapacityBytesPerSec();
paramEstDown.setValue(limit_to_text.getLimitText(limit));
max_download_type.setLabelText(getMBitLimit(limit_to_text, limit.getBytesPerSec()));
max_download.setValue(limit.getBytesPerSec() / kinb);
max_download_type.setValue(limit_to_text.getSettableType(limit));
}
};
sm.addListener(smListener);
// Add listeners to disable setting when needed.
ParameterGroupImpl pgNetworks = new ParameterGroupImpl("ConfigView.section.transfer.autospeed.networks", listNetwork);
add("TASS.pgNetworks", pgNetworks);
BooleanParameterImpl debug_au = new BooleanParameterImpl("Auto Upload Speed Debug Enabled", "ConfigView.section.transfer.autospeed.enabledebug");
add(debug_au);
// ///////////////////////////////////////
// Add group to link to Wiki page.
// ///////////////////////////////////////
add("s1", new LabelParameterImpl(""));
add(new HyperlinkParameterImpl("!" + Constants.APP_NAME + " Wiki AutoSpeed (beta)!", "Utils.link.visit", Wiki.AUTO_SPEED));
}
use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.
the class ConfigSectionTransferAutoSpeedSelect method configSectionCreate.
/**
* Create your own configuration panel here. It can be anything that inherits
* from SWT's Composite class.
* Please be mindfull of small screen resolutions
*
* @param parent The parent of your configuration panel
* @return your configuration panel
*/
@Override
public Composite configSectionCreate(final Composite parent) {
GridData gridData;
Composite cSection = new Composite(parent, SWT.NULL);
if (!CoreFactory.isCoreRunning()) {
cSection.setLayout(new FillLayout());
Label lblNotAvail = new Label(cSection, SWT.WRAP);
Messages.setLanguageText(lblNotAvail, "core.not.available");
return cSection;
}
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
Utils.setLayoutData(cSection, gridData);
GridLayout subPanel = new GridLayout();
subPanel.numColumns = 3;
cSection.setLayout(subPanel);
// V1, V2 ... drop down.
// enable auto-speed beta
// /////////////////////////////////
// AutoSpeed Beta mode group
// /////////////////////////////////
// Beta-mode grouping.
Group modeGroup = new Group(cSection, SWT.NULL);
Messages.setLanguageText(modeGroup, "ConfigTransferAutoSpeed.algorithm.selector");
GridLayout modeLayout = new GridLayout();
modeLayout.numColumns = 3;
modeGroup.setLayout(modeLayout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(modeGroup, gridData);
// Need a drop down to select which method will be used.
Label label = new Label(modeGroup, SWT.NULL);
Messages.setLanguageText(label, "ConfigTransferAutoSpeed.algorithm");
gridData = new GridData();
Utils.setLayoutData(label, gridData);
String AutoSpeedClassic = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.classic");
String AutoSpeedBeta = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.beta");
String[] modeNames = { AutoSpeedClassic, AutoSpeedBeta };
String[] modes = { "1", "2" };
// versionList = new StringListParameter(modeGroup,
// SpeedManagerImpl.CONFIG_VERSION_STR,
// "1",
// modeNames,modes,true);
versionList = new StringListParameter(modeGroup, SpeedManagerImpl.CONFIG_VERSION_STR, modeNames, modes);
long verNum = COConfigurationManager.getLongParameter(SpeedManagerImpl.CONFIG_VERSION);
if (verNum == 1) {
// SpeedManagerAlgorithmProviderV1
versionList.setValue(modes[0]);
} else if (verNum == 2) {
// SpeedManagerAlgorithmProviderV2
versionList.setValue(modes[1]);
} else {
// Should not happen, as we always have a default set
versionList.setValue(modes[0]);
// ToDo: log this condition.
}
versionList.addChangeListener(new ConvertToLongChangeListener());
// spacer
Label spacer = new Label(modeGroup, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
Utils.setLayoutData(spacer, gridData);
// To enable the beta.
gridData = new GridData();
gridData.horizontalIndent = 20;
gridData.horizontalSpan = 2;
enableAutoSpeed = new BooleanParameter(modeGroup, TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, "ConfigView.section.transfer.autospeed.enableauto");
enableAutoSpeed.setLayoutData(gridData);
// enableAutoSpeed.addChangeListener( new GroupModeChangeListener() );
spacer = new Label(modeGroup, SWT.NULL);
// AutoSpeed while seeding enabled.
enableAutoSpeedWhileSeeding = new BooleanParameter(modeGroup, "Auto Upload Speed Seeding Enabled", "ConfigView.section.transfer.autospeed.enableautoseeding");
gridData = new GridData();
gridData.horizontalIndent = 20;
gridData.horizontalSpan = 2;
enableAutoSpeedWhileSeeding.setLayoutData(gridData);
enableAutoSpeed.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(enableAutoSpeedWhileSeeding.getControls(), true));
spacer = new Label(modeGroup, SWT.NULL);
spacer = new Label(cSection, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
Utils.setLayoutData(spacer, gridData);
// NETWORK GROUP
Group networkGroup = new Group(cSection, SWT.NULL);
// networkGroup.addControlListener(new Utils.LabelWrapControlListener());
Messages.setLanguageText(networkGroup, "ConfigView.section.transfer.autospeed.networks");
GridLayout networksLayout = new GridLayout();
networksLayout.numColumns = 5;
networkGroup.setLayout(networksLayout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
networkGroup.setLayoutData(gridData);
// asn
label = new Label(networkGroup, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.asn");
final Label asn_label = new Label(networkGroup, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 4;
gridData.grabExcessHorizontalSpace = true;
asn_label.setLayoutData(gridData);
// up cap
label = new Label(networkGroup, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.estupcap");
gridData = new GridData();
gridData.horizontalIndent = 20;
Utils.setLayoutData(label, gridData);
final Label up_cap = new Label(networkGroup, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 4;
Utils.setLayoutData(up_cap, gridData);
// down cap
label = new Label(networkGroup, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.estdowncap");
gridData = new GridData();
gridData.horizontalIndent = 20;
Utils.setLayoutData(label, gridData);
final Label down_cap = new Label(networkGroup, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 4;
Utils.setLayoutData(down_cap, gridData);
// Core avail: We check at top
final SpeedManager sm = CoreFactory.getSingleton().getSpeedManager();
final TransferStatsView.limitToTextHelper limit_to_text = new TransferStatsView.limitToTextHelper();
asn_label.setText(sm.getASN());
up_cap.setText(limit_to_text.getLimitText(sm.getEstimatedUploadCapacityBytesPerSec()));
down_cap.setText(limit_to_text.getLimitText(sm.getEstimatedDownloadCapacityBytesPerSec()));
// space
spacer = new Label(networkGroup, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 5;
Utils.setLayoutData(spacer, gridData);
// info
Label info_label = new Label(networkGroup, SWT.WRAP);
Messages.setLanguageText(info_label, "ConfigView.section.transfer.autospeed.network.info", new String[] { DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB) });
Utils.setLayoutData(info_label, Utils.getWrappableLabelGridData(5, 0));
// up set
label = new Label(networkGroup, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.estupcap");
gridData = new GridData();
gridData.horizontalIndent = 20;
Utils.setLayoutData(label, gridData);
String co_up = "AutoSpeed Network Upload Speed (temp)";
String co_up_type = "AutoSpeed Network Upload Speed Type (temp)";
SpeedManagerLimitEstimate up_lim = sm.getEstimatedUploadCapacityBytesPerSec();
COConfigurationManager.setParameter(co_up, up_lim.getBytesPerSec() / 1024);
COConfigurationManager.setParameter(co_up_type, limit_to_text.getSettableType(up_lim));
final IntParameter max_upload = new IntParameter(networkGroup, co_up);
final Label upload_bits = new Label(networkGroup, SWT.NULL);
gridData = new GridData();
Utils.setLayoutData(upload_bits, gridData);
upload_bits.setText(getMBitLimit(limit_to_text, (up_lim.getBytesPerSec() / 1024) * 1024));
final StringListParameter max_upload_type = new StringListParameter(networkGroup, co_up_type, limit_to_text.getSettableTypes(), limit_to_text.getSettableTypes());
max_upload_type.addChangeListener(new ParameterChangeAdapter() {
@Override
public void parameterChanged(Parameter p, boolean caused_internally) {
if (max_upload_type.isDisposed()) {
return;
}
float type = limit_to_text.textToType(max_upload_type.getValue());
SpeedManagerLimitEstimate existing = sm.getEstimatedUploadCapacityBytesPerSec();
if (existing.getEstimateType() != type) {
sm.setEstimatedUploadCapacityBytesPerSec(existing.getBytesPerSec(), type);
}
}
});
max_upload.addChangeListener(new ParameterChangeAdapter() {
@Override
public void parameterChanged(Parameter p, boolean caused_internally) {
if (max_upload.isDisposed()) {
return;
}
int value = max_upload.getValue() * 1024;
SpeedManagerLimitEstimate existing = sm.getEstimatedUploadCapacityBytesPerSec();
if (existing.getBytesPerSec() != value) {
sm.setEstimatedUploadCapacityBytesPerSec(value, existing.getEstimateType());
}
}
});
label = new Label(networkGroup, SWT.NULL);
// down set
label = new Label(networkGroup, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.estdowncap");
gridData = new GridData();
gridData.horizontalIndent = 20;
Utils.setLayoutData(label, gridData);
SpeedManagerLimitEstimate down_lim = sm.getEstimatedDownloadCapacityBytesPerSec();
String co_down = "AutoSpeed Network Download Speed (temp)";
String co_down_type = "AutoSpeed Network Download Speed Type (temp)";
COConfigurationManager.setParameter(co_down, down_lim.getBytesPerSec() / 1024);
COConfigurationManager.setParameter(co_down_type, limit_to_text.getSettableType(down_lim));
final IntParameter max_download = new IntParameter(networkGroup, co_down);
final Label download_bits = new Label(networkGroup, SWT.NULL);
gridData = new GridData();
Utils.setLayoutData(download_bits, gridData);
download_bits.setText(getMBitLimit(limit_to_text, (down_lim.getBytesPerSec() / 1024) * 1024));
final StringListParameter max_download_type = new StringListParameter(networkGroup, co_down_type, limit_to_text.getSettableTypes(), limit_to_text.getSettableTypes());
max_download_type.addChangeListener(new ParameterChangeAdapter() {
@Override
public void parameterChanged(Parameter p, boolean caused_internally) {
if (max_download_type.isDisposed()) {
return;
}
float type = limit_to_text.textToType(max_download_type.getValue());
SpeedManagerLimitEstimate existing = sm.getEstimatedDownloadCapacityBytesPerSec();
if (existing.getEstimateType() != type) {
sm.setEstimatedDownloadCapacityBytesPerSec(existing.getBytesPerSec(), type);
}
}
});
max_download.addChangeListener(new ParameterChangeAdapter() {
@Override
public void parameterChanged(Parameter p, boolean caused_internally) {
if (max_download.isDisposed()) {
return;
}
int value = max_download.getValue() * 1024;
SpeedManagerLimitEstimate existing = sm.getEstimatedDownloadCapacityBytesPerSec();
if (existing.getBytesPerSec() != value) {
sm.setEstimatedDownloadCapacityBytesPerSec(value, existing.getEstimateType());
}
}
});
label = new Label(networkGroup, SWT.NULL);
// reset
Label reset_label = new Label(networkGroup, SWT.NULL);
Messages.setLanguageText(reset_label, "ConfigView.section.transfer.autospeed.resetnetwork");
Button reset_button = new Button(networkGroup, SWT.PUSH);
Messages.setLanguageText(reset_button, "ConfigView.section.transfer.autospeed.reset.button");
reset_button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
sm.reset();
}
});
sm.addListener(new SpeedManagerListener() {
private final SpeedManagerListener listener = this;
@Override
public void propertyChanged(final int property) {
Utils.execSWTThread(new Runnable() {
@Override
public void run() {
if (asn_label.isDisposed()) {
sm.removeListener(listener);
} else {
if (property == SpeedManagerListener.PR_ASN) {
asn_label.setText(sm.getASN());
} else if (property == SpeedManagerListener.PR_UP_CAPACITY) {
SpeedManagerLimitEstimate limit = sm.getEstimatedUploadCapacityBytesPerSec();
up_cap.setText(limit_to_text.getLimitText(limit));
upload_bits.setText(getMBitLimit(limit_to_text, limit.getBytesPerSec()));
max_upload.setValue(limit.getBytesPerSec() / 1024);
max_upload_type.setValue(limit_to_text.getSettableType(limit));
} else if (property == SpeedManagerListener.PR_DOWN_CAPACITY) {
SpeedManagerLimitEstimate limit = sm.getEstimatedDownloadCapacityBytesPerSec();
down_cap.setText(limit_to_text.getLimitText(limit));
download_bits.setText(getMBitLimit(limit_to_text, limit.getBytesPerSec()));
max_download.setValue(limit.getBytesPerSec() / 1024);
max_download_type.setValue(limit_to_text.getSettableType(limit));
}
}
}
});
}
});
// Add listeners to disable setting when needed.
// spacer
spacer = new Label(cSection, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
Utils.setLayoutData(spacer, gridData);
BooleanParameter debug_au = new BooleanParameter(cSection, "Auto Upload Speed Debug Enabled", "ConfigView.section.transfer.autospeed.enabledebug");
gridData = new GridData();
gridData.horizontalSpan = 3;
debug_au.setLayoutData(gridData);
// spacer
spacer = new Label(cSection, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
Utils.setLayoutData(spacer, gridData);
// ///////////////////////////////////////
// Add group to link to Wiki page.
// ///////////////////////////////////////
Group azWiki = new Group(cSection, SWT.WRAP);
gridData = new GridData();
Utils.setLayoutData(azWiki, gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 1;
layout.marginWidth = 20;
azWiki.setLayout(layout);
azWiki.setText(MessageText.getString("Utils.link.visit"));
final Label linkLabel = new Label(azWiki, SWT.NULL);
linkLabel.setText(Constants.APP_NAME + " Wiki AutoSpeed (beta)");
linkLabel.setData(Constants.URL_WIKI + "w/Auto_Speed");
linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
linkLabel.setForeground(Colors.blue);
gridData = new GridData();
Utils.setLayoutData(linkLabel, gridData);
linkLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent arg0) {
Utils.launch((String) ((Label) arg0.widget).getData());
}
@Override
public void mouseUp(MouseEvent arg0) {
Utils.launch((String) ((Label) arg0.widget).getData());
}
});
ClipboardCopy.addCopyToClipMenu(linkLabel);
return cSection;
}
use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.
the class TransferStatsView method getMapperTitle.
protected String getMapperTitle(SpeedManagerPingMapper mapper) {
if (mapper.isActive()) {
SpeedManagerLimitEstimate up_1 = mapper.getEstimatedUploadLimit(false);
SpeedManagerLimitEstimate up_2 = mapper.getEstimatedUploadLimit(true);
SpeedManagerLimitEstimate down_1 = mapper.getEstimatedDownloadLimit(false);
SpeedManagerLimitEstimate down_2 = mapper.getEstimatedDownloadLimit(true);
return ("ul=" + DisplayFormatters.formatByteCountToKiBEtc(up_1.getBytesPerSec()) + ":" + DisplayFormatters.formatByteCountToKiBEtc(up_2.getBytesPerSec()) + ",dl=" + DisplayFormatters.formatByteCountToKiBEtc(down_1.getBytesPerSec()) + ":" + DisplayFormatters.formatByteCountToKiBEtc(down_2.getBytesPerSec()) + ",mr=" + DisplayFormatters.formatDecimal(mapper.getCurrentMetricRating(), 2));
}
return ("");
}
Aggregations