Package org.eclipse.test.internal.performance.data

Examples of org.eclipse.test.internal.performance.data.Dim


        String spaces= "                                                                                                       "; //$NON-NLS-1$

        ps.println("(average over " + n + " samples):"); //$NON-NLS-1$ //$NON-NLS-2$
        for (int i= 0; i < dimensions.length; i++) {
          Dim dimension= dimensions[i];
          double mean= s.getAverage(dimension);

          String nameString= "  " + dimension.getName() + ":"; //$NON-NLS-1$ //$NON-NLS-2$
          String meanString= dimension.getDisplayValue(mean);
          int align= firstNonDigit(meanString);
          meanString= spaces.substring(0, 30 - align - nameString.length()) + meanString;

          align= nameString.length() + meanString.length();

          Percentile percentile= StatisticsUtil.T95;
          double[] confidenceInterval= s.getConfidenceInterval(dimension, percentile);

          String confidenceString= n <= 2
          ? " (no confidence)" //$NON-NLS-1$
              : spaces.substring(0, 40 - align) + format.format(new Object[] {new Double(percentile.inside()), dimension.getDisplayValue(confidenceInterval[0]), dimension.getDisplayValue(confidenceInterval[1])});

          align+= confidenceString.length();
          String sizeWarning;
          try {
            sizeWarning= spaces.substring(0, 70 - align) + checkSampleSize(s, sample, dimension);
          } catch (CoreException x) {
            badDimensions.add(dimension);
            continue;
          }

          ps.println(nameString + meanString + confidenceString + sizeWarning);
        }
       
        if (!badDimensions.isEmpty()) {
          ps.print("  Dimensions with unusable statistical properties: "); //$NON-NLS-1$
          for (Iterator iter= badDimensions.iterator(); iter.hasNext();) {
            Dim dimension= (Dim) iter.next();
            ps.print(dimension.getName());
            if (iter.hasNext())
              ps.print(", "); //$NON-NLS-1$
          }
          ps.println();
        }
View Full Code Here


      Dim[] dimensions= dataPoints[0].getDimensions();
      Arrays.sort(dimensions, new DimensionComparator());
      if (dimensions.length > 0) {
        /* print dimensions */
        for (int d= 0; d < dimensions.length; d++) {
          Dim dimension= dimensions[d];
          ps.print(dimension.getName());
          ps.print(SEPARATOR);
        }
        ps.println("scenario"); //$NON-NLS-1$
       
        for (int p= 0; p < dataPoints.length - 1; p+=2) {
          DataPoint before= dataPoints[p];
          DataPoint after= dataPoints[p + 1];
          for (int d= 0; d < dimensions.length; d++) {
            Dim dimension= dimensions[d];
            long valBefore= before.getScalar(dimension).getMagnitude();
            long valAfter= after.getScalar(dimension).getMagnitude();
            ps.print(valAfter - valBefore);
            ps.print(SEPARATOR);
          }
View Full Code Here

    fLowerBand= lowerBand;
    fUpperBand= upperBand;
  }
 
  public boolean test(StatisticsSession reference, StatisticsSession measured, StringBuffer message) {
    Dim dimension= getDimension();

    if (!measured.contains(dimension)) {
          PerformanceTestPlugin.logWarning("collected data provides no dimension '"+dimension.getName()+'\''); //$NON-NLS-1$
      return true;
    }
    if (!reference.contains(dimension)) {
        PerformanceTestPlugin.logWarning("reference data provides no dimension '"+dimension.getName()+'\''); //$NON-NLS-1$
      return true;
    }
   
    double actual= measured.getAverage(dimension);
    double test= reference.getAverage(dimension);
   
    if (actual > fUpperBand + test || actual < test - fLowerBand) {
      message.append('\n' + dimension.getName() + ": " + dimension.getDisplayValue(actual) + " is not within [-" + dimension.getDisplayValue(new Scalar(null, fLowerBand)) + ", +" + dimension.getDisplayValue(new Scalar(null, fUpperBand)) + "] of " + dimension.getDisplayValue(test)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
      return false;
    }
   
    return true;
 
View Full Code Here

   
    void countAllDimensions(PrintStream ps) throws SQLException {
        PreparedStatement stmt= fConnection.prepareStatement("select distinct DIM_ID from SCALAR"); //$NON-NLS-1$
        ResultSet set= stmt.executeQuery();
        while (set.next()) {
            Dim dimension= Dim.getDimension(set.getInt(1));
            if (dimension != null)
                countDimension(ps, dimension);
        }
    }
View Full Code Here

/*
* Set the build value from database information.
*/
void setValue(int dim_id, int step, long value) {
  int length = SUPPORTED_DIMS.length;
  Dim dimension = getDimension(dim_id);
  int idx = 0;
  if (this.dimensions == null){
    this.dimensions = new Dim[length];
    this.average = new double[length];
    this.stddev = new double[length];
View Full Code Here

                StatisticsSession stats= new StatisticsSession(dataPoints);
                Dim[] dims= dataPoints[0].getDimensions();

                int datapoint_id= fSQL.createDataPoint(sample_id, 0, InternalPerformanceMeter.AVERAGE);
                for (int i= 0; i < dims.length; i++) {
                    Dim dim= dims[i];
                    fSQL.insertScalar(datapoint_id, dim.getId(), (long) stats.getAverage(dim));
                }
               
                datapoint_id= fSQL.createDataPoint(sample_id, 0, InternalPerformanceMeter.STDEV);
                for (int i= 0; i < dims.length; i++) {
                    Dim dim= dims[i];
                    // see StatisticsSession
                    long value= Double.doubleToLongBits(stats.getStddev(dim));
                    fSQL.insertScalar(datapoint_id, dim.getId(), value);
                }
               
                datapoint_id= fSQL.createDataPoint(sample_id, 0, InternalPerformanceMeter.SIZE);
                for (int i= 0; i < dims.length; i++) {
                    Dim dim= dims[i];
                    fSQL.insertScalar(datapoint_id, dim.getId(), stats.getCount(dim));
                }
        } else {
        for (int i= 0; i < dataPoints.length; i++) {
            DataPoint dp= dataPoints[i];
                int datapoint_id= fSQL.createDataPoint(sample_id, i, dp.getStep());
View Full Code Here

              HashMap map= new HashMap();     
              ResultSet rs2= fSQL.queryScalars(datapoint_id);
            while (rs2.next()) {
                  int dim_id= rs2.getInt(1);
                  long value= rs2.getBigDecimal(2).longValue();               
                  Dim dim= Dim.getDimension(dim_id);
                  if (dim != null) {
                      if (dimSet == null || dimSet.contains(dim))
                          map.put(dim, new Scalar(dim, value));
                  }
            }
View Full Code Here

    fLowerBand= lowerBand;
    fUpperBand= upperBand;
  }

  public boolean test(StatisticsSession reference, StatisticsSession measured, StringBuffer message) {
    Dim dimension= getDimension();
   
    if (!measured.contains(dimension)) {
        PerformanceTestPlugin.logWarning("collected data provides no dimension '"+dimension.getName()+'\''); //$NON-NLS-1$
      return true;
    }
    if (!reference.contains(dimension)) {
        PerformanceTestPlugin.logWarning("reference data provides no dimension '"+dimension.getName()+'\''); //$NON-NLS-1$
      return true;
    }
   
    double actual= measured.getAverage(dimension);
    double test= reference.getAverage(dimension);
   
    if (test < 0.001 && test > -0.001) {
      // we don't fail for reference value of zero
        PerformanceTestPlugin.logWarning("ref value for '"+dimension.getName()+"' is too small"); //$NON-NLS-1$ //$NON-NLS-2$
      return true;
    }
    if (actual < 0) {
      // we don't fail for negative values
        PerformanceTestPlugin.logWarning("actual value for '"+dimension.getName()+"' is negative"); //$NON-NLS-1$ //$NON-NLS-2$
      return true;
    }
   
    if (actual > fUpperBand * test || actual < fLowerBand * test) {
      message.append('\n' + dimension.getName() + ": " + dimension.getDisplayValue(actual) + " is not within [" + Math.round(fLowerBand * 100)+ "%, " + Math.round(fUpperBand * 100) + "%] of " + dimension.getDisplayValue(test)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
      return false;
    }
    return true;
 
View Full Code Here

          r.addCellRight(timeSeriesLabels[j]);
      r.nextRow();
                 
      Dim[] dimensions= getDimensions();
      for (int i= 0; i < dimensions.length; i++) {
          Dim dim= dimensions[i];
          r.addCell(dim.getName() + ':');
         
          TimeSeries ts= getTimeSeries(dim);
          int n= ts.getLength();
          for (int j= 0; j < n; j++) {
              String stddev= ""; //$NON-NLS-1$
              double stddev2= ts.getStddev(j);
              if (stddev2 != 0.0)
                stddev= " [" + dim.getDisplayValue(stddev2) + "]"; //$NON-NLS-1$ //$NON-NLS-2$
              r.addCellRight(dim.getDisplayValue(ts.getValue(j)) + stddev);
          }
          r.nextRow();
      }
      r.print(ps);
      ps.println();
View Full Code Here

       
        fDimensions= (Dim[]) dims.toArray(new Dim[dims.size()]);
        Arrays.sort(fDimensions,
        new Comparator() {
              public int compare(Object o1, Object o2) {
                  Dim d1= (Dim)o1;
                  Dim d2= (Dim)o2;
                  return d1.getName().compareTo(d2.getName());
              }
          }
        );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.test.internal.performance.data.Dim

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.