Package com.aelitis.azureus.core.speedmanager

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


        int  x_var  = phase[2];
        int r = phase[3];
       
        pm.addPing( x_base + rand.nextInt( x_var ), x_base + rand.nextInt( x_var ), rand.nextInt( r ), false);
     
        SpeedManagerLimitEstimate up   = pm.getEstimatedUploadLimit( false );
        SpeedManagerLimitEstimate down   = pm.getEstimatedDownloadLimit( false );
       
        if ( up != null && down != null ){
         
          System.out.println( up.getString() + "," + down.getString());
        }
      }
    }
  }
View Full Code Here


  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( "" );
  }
View Full Code Here

        int  x = x_axis_left_x + ( x_axis_right_x - x_axis_left_x )*i/10;
       
        gc.drawLine( x, x_axis_left_y, x, x_axis_left_y+4 );
      }
     
      SpeedManagerLimitEstimate le = mapper.getEstimatedUploadLimit( false );
     
      if ( le != null ){
       
        gc.setForeground(Colors.grey );
       
        int[][] segs = le.getSegments();
       
        if ( segs.length > 0 ){
         
          int  max_metric   = 0;
          int  max_pos    = 0;
         
          for (int i=0;i<segs.length;i++){
           
            int[]  seg = segs[i];
           
            max_metric   = Math.max( max_metric, seg[0] );
            max_pos     = Math.max( max_pos, seg[2] );
          }
         
          double  metric_ratio   = max_metric==0?1:((float)50/max_metric);
          double  pos_ratio     = max_pos==0?1:((float)usable_width/max_pos);
         
          int  prev_x  = 1;
          int  prev_y  = 1;
         
          for (int i=0;i<segs.length;i++){
           
            int[]  seg = segs[i];
           
            int  next_x   = (int)((seg[1] + (seg[2]-seg[1])/2)*pos_ratio) + 1;
            int  next_y  = (int)((seg[0])*metric_ratio) + 1;
           
            gc.drawLine(
                x_axis_left_x + prev_x,
                x_axis_left_y - prev_y,
                x_axis_left_x + next_x,
                x_axis_left_y - next_y );
                           
            prev_x = next_x;
            prev_y = next_y;
          }
        }
       
        gc.setForeground( Colors.black );
      }
     
      SpeedManagerLimitEstimate[] bad_up = mapper.getBadUploadHistory();
     
      if ( bad_up.length > 0 ){
       
        gc.setLineWidth( 3 );
       
        gc.setForeground( Colors.red );

        for (int i=0;i<bad_up.length;i++){
         
          int speed = bad_up[i].getBytesPerSec();
         
          int  x = max_x == 0?0:(speed * usable_width / max_x);
       
          gc.drawLine(
              x_axis_left_x + x,
              x_axis_left_y - 0,
              x_axis_left_x + x,
              x_axis_left_y - 10 );

        }
       
        gc.setForeground( Colors.black );
       
        gc.setLineWidth( 1 );
      }
     
      String x_text = labels[0] + " - " + formatters[0].format( max_x+1 );

      gc.drawText(   x_text,
              x_axis_right_x - 20 - x_text.length()*char_width,
              x_axis_right_y - font_height - 2,
              SWT.DRAW_TRANSPARENT );

        // y axis

      int y_axis_bottom_x = PAD_LEFT;
      int y_axis_bottom_y = usable_height + PAD_TOP;

      int y_axis_top_x   = PAD_LEFT;
      int y_axis_top_y   = PAD_TOP;

      gc.drawLine( y_axis_bottom_x, y_axis_bottom_y, y_axis_top_x, y_axis_top_y );

      gc.drawLine( y_axis_top_x-4, y_axis_top_y+PAD_TOP,  y_axis_top_x, y_axis_top_y );
      gc.drawLine( y_axis_top_x+4, y_axis_top_y+PAD_TOP,  y_axis_top_x, y_axis_top_y );

      for (int i=1;i<10;i++){
       
        int  y = y_axis_bottom_y + ( y_axis_top_y - y_axis_bottom_y )*i/10;
       
        gc.drawLine( y_axis_bottom_x, y, y_axis_bottom_x-4, y );
      }
     
      le = mapper.getEstimatedDownloadLimit( false );
     
      if ( le != null ){
       
        gc.setForeground(Colors.grey );
       
        int[][] segs = le.getSegments();
       
        if ( segs.length > 0 ){
         
          int  max_metric   = 0;
          int  max_pos    = 0;
View Full Code Here

TOP

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

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.