Package com.aelitis.azureus.core.speedmanager

Examples of com.aelitis.azureus.core.speedmanager.SpeedManager


        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.widthHint = 80;
        c1.setLayoutData(gridData);

        SpeedManager sm = AzureusCoreFactory.getSingleton().getSpeedManager();

        if ( uploadTestRan ){

            //Since cable modems can over estimate upload need to drop type setting to estimate.
            sm.setEstimatedUploadCapacityBytesPerSec(
              measuredUploadKbps*1024,
              uploadHitLimit?
                SpeedManagerLimitEstimate.TYPE_ESTIMATED :SpeedManagerLimitEstimate.TYPE_ESTIMATED);
        }

        if ( downloadTestRan ){
         
          sm.setEstimatedDownloadCapacityBytesPerSec(
              measuredDownloadKbps*1024,
              downloadHitLimit?
                SpeedManagerLimitEstimate.TYPE_MEASURED_MIN :SpeedManagerLimitEstimate.TYPE_MEASURED);
        }

View Full Code Here


        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 4;
        down_cap.setLayoutData(gridData);

        // Core avail: We check at top
        final SpeedManager sm = AzureusCoreFactory.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;
        spacer.setLayoutData(gridData);
       
          // info
       
      Label info_label = new Label(networkGroup, SWT.WRAP );
      Messages.setLanguageText(
          info_label, CFG_PREFIX + "network.info",
          new String[]{ DisplayFormatters.getRateUnit( DisplayFormatters.UNIT_KB )});
      info_label.setLayoutData(Utils.getWrappableLabelGridData(5, 0));
       
        // up set
     
      label = new Label(networkGroup, SWT.NULL);
      Messages.setLanguageText(label,"SpeedView.stats.estupcap");   
      gridData = new GridData();
      gridData.horizontalIndent = 20;
      label.setLayoutData(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();
      upload_bits.setLayoutData(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()
      {
        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()
      {
        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;
      label.setLayoutData(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();
      download_bits.setLayoutData(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()
      {
        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()
      {
        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, CFG_PREFIX + "resetnetwork");

      Button reset_button = new Button(networkGroup, SWT.PUSH);

      Messages.setLanguageText(reset_button, CFG_PREFIX + "reset.button" );

      reset_button.addListener(SWT.Selection,
        new Listener()
      {
            public void
        handleEvent(Event event)
            {
              sm.reset();
            }
        });
       
     sm.addListener(
             new SpeedManagerListener()
             {
               private final SpeedManagerListener  listener = this;
              
               public void
               propertyChanged(
                 final int property
               {
                 Utils.execSWTThread(
                   new Runnable()
                   {
                     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()));
                          
View Full Code Here

        up_lim = NetworkManager.getMaxUploadRateBPSSeedingOnly();
      }
     
      glob.put( "u_lim", new Long( up_lim ));
     
      SpeedManager sm = core.getSpeedManager();
     
      if ( sm != null ){
       
        glob.put( "u_cap", new Long( sm.getEstimatedUploadCapacityBytesPerSec().getBytesPerSec()));
        glob.put( "d_cap", new Long( sm.getEstimatedDownloadCapacityBytesPerSec().getBytesPerSec()));
      }
     
      List<DownloadManager> dms = getDownloadManagers();
     
      int  comp   = 0;
View Full Code Here

 
    public static boolean
    isAutoUploadAvailable(
      AzureusCore  core )
    {
      SpeedManager speedManager = core.getSpeedManager();
      return speedManager == null ? false : speedManager.isAvailable();
    }
View Full Code Here

    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
View Full Code Here

    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
View Full Code Here

    /**
     * replaces - updateFromCOConfigManager()
     */
    public void readFromPersistentMap(){
        //get persistent mapper.
        SpeedManager sm = AzureusCoreFactory.getSingleton().getSpeedManager();

        //get upload estimate.
        SpeedManagerLimitEstimate uEst = SMConst.filterEstimate(
                                            sm.getEstimatedUploadCapacityBytesPerSec(),
                                            SMConst.START_UPLOAD_RATE_MAX );

        int upPingMapLimit = uEst.getBytesPerSec();
        if(upPingMapLimit<SMConst.START_UPLOAD_RATE_MAX){
            //will find upload limit via slow search.
            uploadLimitMax = SMConst.START_UPLOAD_RATE_MAX;
        }else{
            uploadLimitMax = upPingMapLimit;
        }
        uploadLimitMin = SMConst.calculateMinUpload( uploadLimitMax );


        //get download estimate.
        SpeedManagerLimitEstimate dEst = SMConst.filterEstimate(
                                            sm.getEstimatedDownloadCapacityBytesPerSec(),
                                            SMConst.START_DOWNLOAD_RATE_MAX );


        int downPingMapLimit = dEst.getBytesPerSec();
        if( isSettingDownloadUnlimited() ){
View Full Code Here

        int tuploadLimitMax = COConfigurationManager.getIntParameter(SpeedManagerAlgorithmProviderV2.SETTING_UPLOAD_MAX_LIMIT);
        int tdownloadLimitMax =COConfigurationManager.getIntParameter(SpeedManagerAlgorithmProviderV2.SETTING_DOWNLOAD_MAX_LIMIT);

        //for testing.
        SpeedManager sm = AzureusCoreFactory.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 ));
View Full Code Here

     */
    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.
View Full Code Here

      COConfigurationManager.setParameter( "enable.seedingonly.upload.rate", false );
      COConfigurationManager.setParameter( "max active torrents",wizard.maxActiveTorrents);
      COConfigurationManager.setParameter( "max downloads",wizard.maxDownloads);
     
      try{
        SpeedManager sm = AzureusCoreFactory.getSingleton().getSpeedManager();
     
        boolean is_manual = wizard.isUploadLimitManual();
       
        sm.setEstimatedUploadCapacityBytesPerSec( upLimit, is_manual?SpeedManagerLimitEstimate.TYPE_MANUAL:SpeedManagerLimitEstimate.TYPE_MEASURED );
       
      }catch( Throwable e ){
       
        Debug.out( e );
      }
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.speedmanager.SpeedManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.