Search in sources :

Example 6 with SpeedManagerPingMapper

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);
    }
}
Also used : SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Example 7 with SpeedManagerPingMapper

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();
    }
}
Also used : SpeedManagerAlgorithmProviderAdapter(com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Example 8 with SpeedManagerPingMapper

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Canvas(org.eclipse.swt.widgets.Canvas) TabFolder(org.eclipse.swt.widgets.TabFolder) BufferedLabel(com.biglybt.ui.swt.components.BufferedLabel) Label(org.eclipse.swt.widgets.Label) ValueFormater(com.biglybt.ui.swt.components.graphics.ValueFormater) Point(org.eclipse.swt.graphics.Point) TransportStartpoint(com.biglybt.core.networkmanager.TransportStartpoint) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) StackLayout(org.eclipse.swt.custom.StackLayout) SpeedManagerPingMapper(com.biglybt.core.speedmanager.SpeedManagerPingMapper)

Aggregations

SpeedManagerPingMapper (com.biglybt.core.speedmanager.SpeedManagerPingMapper)8 SpeedManagerLimitEstimate (com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)7 SpeedManagerAlgorithmProviderAdapter (com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter)5 TransportStartpoint (com.biglybt.core.networkmanager.TransportStartpoint)1 PEPeerManager (com.biglybt.core.peer.PEPeerManager)1 PEPeerManagerStats (com.biglybt.core.peer.PEPeerManagerStats)1 BufferedLabel (com.biglybt.ui.swt.components.BufferedLabel)1 ValueFormater (com.biglybt.ui.swt.components.graphics.ValueFormater)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 StackLayout (org.eclipse.swt.custom.StackLayout)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Canvas (org.eclipse.swt.widgets.Canvas)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 TabFolder (org.eclipse.swt.widgets.TabFolder)1