use of com.biglybt.core.speedmanager.SpeedManagerPingMapper in project BiglyBT by BiglySoftware.
the class SpeedLimitMonitor method hadChockingPing.
// guessUploadLimit
/**
* Should return true if had a recent chocking ping.
* @return - true if
*/
public boolean hadChockingPing() {
if (!useVariancePingMap) {
return pingMapOfDownloadMode.hadChockingPing(true);
} else {
SpeedManagerPingMapper pm = SMInstance.getInstance().getAdapter().getPingMapper();
// if either had a choking ping.
SpeedManagerLimitEstimate dEst = pm.getEstimatedDownloadLimit(true);
SpeedManagerLimitEstimate uEst = pm.getEstimatedUploadLimit(true);
boolean hadChokePingUp = (uEst.getEstimateType() == SpeedManagerLimitEstimate.TYPE_CHOKE_ESTIMATED);
boolean hadChokePingDown = (dEst.getEstimateType() == SpeedManagerLimitEstimate.TYPE_CHOKE_ESTIMATED);
return (hadChokePingUp || hadChokePingDown);
}
}
use of com.biglybt.core.speedmanager.SpeedManagerPingMapper 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();
}
}
use of com.biglybt.core.speedmanager.SpeedManagerPingMapper in project BiglyBT by BiglySoftware.
the class TransferStatsView method createAutoSpeedPanel.
private void createAutoSpeedPanel() {
autoSpeedPanel = new Group(mainPanel, SWT.NONE);
GridData generalPanelData = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(autoSpeedPanel, generalPanelData);
Messages.setLanguageText(autoSpeedPanel, "SpeedView.stats.autospeed", new String[] { String.valueOf(MAX_DISPLAYED_PING_MILLIS_DISP) });
autoSpeedPanelLayout = new StackLayout();
autoSpeedPanel.setLayout(autoSpeedPanelLayout);
autoSpeedInfoPanel = new Composite(autoSpeedPanel, SWT.NULL);
Utils.setLayoutData(autoSpeedInfoPanel, new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 8;
layout.makeColumnsEqualWidth = true;
autoSpeedInfoPanel.setLayout(layout);
Canvas pingCanvas = new Canvas(autoSpeedInfoPanel, SWT.NO_BACKGROUND);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 4;
Utils.setLayoutData(pingCanvas, gridData);
pingGraph.initialize(pingCanvas);
TabFolder folder = new TabFolder(autoSpeedInfoPanel, SWT.LEFT);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 4;
Utils.setLayoutData(folder, gridData);
folder.setBackground(Colors.background);
ValueFormater speed_formatter = new ValueFormater() {
@Override
public String format(int value) {
return (DisplayFormatters.formatByteCountToKiBEtc(value));
}
};
ValueFormater time_formatter = new ValueFormater() {
@Override
public String format(int value) {
return (value + " ms");
}
};
ValueFormater[] formatters = new ValueFormater[] { speed_formatter, speed_formatter, time_formatter };
String[] labels = new String[] { "up", "down", "ping" };
SpeedManagerPingMapper[] mappers = speedManager.getMappers();
plot_views = new plotView[mappers.length];
zone_views = new zoneView[mappers.length];
for (int i = 0; i < mappers.length; i++) {
SpeedManagerPingMapper mapper = mappers[i];
TabItem plot_item = new TabItem(folder, SWT.NULL);
plot_item.setText("Plot " + mapper.getName());
Canvas plotCanvas = new Canvas(folder, SWT.NO_BACKGROUND);
gridData = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(plotCanvas, gridData);
plot_views[i] = new plotView(mapper, plotCanvas, labels, formatters);
plot_item.setControl(plotCanvas);
TabItem zones_item = new TabItem(folder, SWT.NULL);
zones_item.setText("Zones " + mapper.getName());
Canvas zoneCanvas = new Canvas(folder, SWT.NO_BACKGROUND);
gridData = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(zoneCanvas, gridData);
zone_views[i] = new zoneView(mapper, zoneCanvas, labels, formatters);
zones_item.setControl(zoneCanvas);
}
autoSpeedDisabledPanel = new Composite(autoSpeedPanel, SWT.NULL);
autoSpeedDisabledPanel.setLayout(new GridLayout());
Label disabled = new Label(autoSpeedDisabledPanel, SWT.NULL);
disabled.setEnabled(false);
Messages.setLanguageText(disabled, "SpeedView.stats.autospeed.disabled");
Utils.setLayoutData(disabled, new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL));
autoSpeedPanelLayout.topControl = speedManager.isAvailable() ? autoSpeedInfoPanel : autoSpeedDisabledPanel;
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 8;
Legend.createLegendComposite(autoSpeedInfoPanel, PingGraphic.defaultColors, new String[] { "TransferStatsView.legend.pingaverage", "TransferStatsView.legend.ping1", "TransferStatsView.legend.ping2", "TransferStatsView.legend.ping3" }, gridData);
}
Aggregations