Package org.eclipse.test.internal.performance.results.db

Examples of org.eclipse.test.internal.performance.results.db.ConfigResults


void printSummary(String configName, String configBox, ComponentResults componentResults, File outputDir, SubMonitor subMonitor) {
  Iterator scenarios = componentResults.getResults();
  while (scenarios.hasNext()) {
    List highlightedPoints = new ArrayList();
    ScenarioResults scenarioResults = (ScenarioResults) scenarios.next();
    ConfigResults configResults = scenarioResults.getConfigResults(configName);
    if (configResults == null || !configResults.isValid()) continue;

    // get latest points of interest matching
    if (this.pointsOfInterest != null) {
      Iterator buildPrefixes = this.pointsOfInterest.iterator();
      while (buildPrefixes.hasNext()) {
        String buildPrefix = (String) buildPrefixes.next();
        List builds = configResults.getBuilds(buildPrefix);
        if (buildPrefix.indexOf('*') <0 && buildPrefix.indexOf('?') < 0) {
          if (builds.size() > 0) {
            highlightedPoints.add(builds.get(builds.size()-1));
          }
        } else {
          highlightedPoints.addAll(builds);
        }
      }
    }

    String scenarioFileName = scenarioResults.getFileName();
    File outputFile = new File(outputDir, scenarioFileName+".html");
    PrintStream stream = null;
    try {
      stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile)));
    } catch (FileNotFoundException e) {
      System.err.println("can't create output file" + outputFile); //$NON-NLS-1$
    }
    if (stream == null) {
      stream = System.out;
    }
    stream.print(Utils.HTML_OPEN);
    stream.print(Utils.HTML_DEFAULT_CSS);

    stream.print("<title>" + scenarioResults.getName() + "(" + configBox + ")" + "</title></head>\n"); //$NON-NLS-1$
    stream.print("<h4>Scenario: " + scenarioResults.getName() + " (" + configBox + ")</h4><br>\n"); //$NON-NLS-1$ //$NON-NLS-2$

    String failureMessage = Utils.failureMessage(configResults.getCurrentBuildDeltaInfo(), true);
     if (failureMessage != null){
         stream.print("<table><tr><td><b>"+failureMessage+"</td></tr></table>\n");
     }

     BuildResults currentBuildResults = configResults.getCurrentBuildResults();
     String comment = currentBuildResults.getComment();
    if (comment != null) {
      stream.print("<p><b>Note:</b><br>\n");
      stream.print(comment + "</p>\n");
    }

    // Print link to raw data.
    String rawDataFile = "raw/" + scenarioFileName+".html";
    stream.print("<br><br><b><a href=\""+rawDataFile+"\">Raw data and Stats</a></b><br><br>\n");
    stream.print("<b>Click measurement name to view line graph of measured values over builds.</b><br><br>\n");
    if (subMonitor.isCanceled()) throw new OperationCanceledException();

    try {
      // Print build result table
      stream.print("<table border=\"1\">\n"); //$NON-NLS-1$
      stream.print("<tr><td><b>Build Id</b></td>"); //$NON-NLS-1$
      int dimLength = this.dimensions.length;
      for (int d=0; d<dimLength; d++) {
        Dim dim = this.dimensions[d];
        stream.print("<td><a href=\"#" + dim.getLabel() + "\"><b>" + dim.getName() + "</b></a></td>");
      }
      stream.print("</tr>\n");

      // Write build lines
      printTableLine(stream, currentBuildResults);
      printTableLine(stream, configResults.getBaselineBuildResults());

      // Write difference line
      printDifferenceLine(stream, configResults);

      // End of table
View Full Code Here


*/
private void printDetails(String configName, String configBox, ComponentResults componentResults, File outputDir) {
  Iterator scenarios = componentResults.getResults();
  while (scenarios.hasNext()) {
    ScenarioResults scenarioResults = (ScenarioResults) scenarios.next();
    ConfigResults configResults = scenarioResults.getConfigResults(configName);
    if (configResults == null || !configResults.isValid()) continue;
    String scenarioName= scenarioResults.getName();
    String scenarioFileName = scenarioResults.getFileName();
    File outputFile = createFile(outputDir, "raw", scenarioFileName, "html");
    PrintStream stream = null;
    try {
View Full Code Here

/*
* Print the scenario statistics value for the given configuration.
*/
private void printConfigStats(ScenarioResults scenarioResults, String config) {
  ConfigResults configResults = scenarioResults.getConfigResults(config);
  if (configResults == null || !configResults.isValid()) {
    this.stream.print("<td>n/a</td>");
    return;
  }
  BuildResults currentBuildResults = configResults.getCurrentBuildResults();
  String failure = currentBuildResults.getFailure();
  double[] deviation = configResults.getCurrentBuildDeltaInfo();
  int confidence = Utils.confidenceLevel(deviation);
  boolean hasFailure = failure != null;
  String comment = currentBuildResults.getComment();
  String image = Utils.getImage(confidence, hasFailure, comment != null);
  this.stream.print("<td><a ");
  if (!hasFailure|| (confidence & Utils.NAN) != 0 || failure.length() == 0){
    // write deviation with error in table when test pass
    this.stream.print("href=\"");
    this.stream.print(configResults.getName());
    this.stream.print('/');
    this.stream.print(scenarioResults.getFileName());
    this.stream.print(".html\">\n");
    this.stream.print("<img hspace=\"10\" border=\"0\" src=\"");
    this.stream.print(image);
    this.stream.print("\"/></a>\n");
  } else {
    // create message with tooltip text including deviation with error plus failure message
    this.jsIdCount+=1;
    this.stream.print("class=\"tooltipSource\" onMouseover=\"show_element('toolTip");
    this.stream.print(this.jsIdCount);
    this.stream.print("')\" onMouseout=\"hide_element('toolTip");
    this.stream.print(this.jsIdCount);
    this.stream.print("')\" \nhref=\"");
    this.stream.print(configResults.getName());
    this.stream.print('/');
    this.stream.print(scenarioResults.getFileName());
    this.stream.print(".html\">\n");
    this.stream.print("<img hspace=\"10\" border=\"0\" src=\"");
    this.stream.print(image);
View Full Code Here

  this.areas = new BarGraphArea[this.count];
  double max = kind == TIME_LOG ? Math.log(this.maxValue) : this.maxValue;
  for (int i=0, y=MARGIN; i < this.count; i++, y+=LINE_HEIGHT) {

    // get builds info
    ConfigResults configResults = this.results[i];
    this.areas[i] = new BarGraphArea(configResults);
    BarGraphArea graphArea = this.areas[i];
    BuildResults currentBuildResults = configResults.getCurrentBuildResults();
    double currentValue = currentBuildResults.getValue();
    double currentError = currentBuildResults.getError();
    double error = configResults.getError();
    boolean singleTest = Double.isNaN(error);
    boolean isSignificant = singleTest || error < Utils.STANDARD_ERROR_THRESHOLD;
    boolean isCommented = currentBuildResults.getComment() != null;
    BuildResults baselineBuildResults = configResults.getBaselineBuildResults();
    double baselineValue = baselineBuildResults.getValue();
    double baselineError = baselineBuildResults.getError();

    // draw baseline build bar
    Color whiteref = (Color) this.resources.get("whiteref");
    if (whiteref == null) {
      whiteref = new Color(DEFAULT_DISPLAY, 240, 240, 248);
      this.resources.put("whiteref", whiteref);
    }
    this.gc.setBackground(whiteref);
    double baselineGraphValue = kind == TIME_LOG ? Math.log(baselineValue) : baselineValue;
    int baselineBarLength= (int) (baselineGraphValue / max * this.graphWidth);
    int baselineErrorLength= (int) (baselineError / max * this.graphWidth / 2);
    int labelxpos = MARGIN + baselineBarLength;
    if (kind == TIME_LOG || baselineErrorLength <= 1) {
      this.gc.fillRectangle(MARGIN, y + (GAP/2), baselineBarLength, BAR_HEIGHT);
      Rectangle rec = new Rectangle(MARGIN, y + (GAP/2), baselineBarLength, BAR_HEIGHT);
      this.gc.drawRectangle(rec);
      graphArea.addArea(rec, "Time for baseline build "+baselineBuildResults.getName()+": "+Util.timeString((long)baselineValue));
    } else {
      int wr = baselineBarLength - baselineErrorLength;
      Rectangle recValue = new Rectangle(MARGIN, y + (GAP/2), wr, BAR_HEIGHT);
      this.gc.fillRectangle(recValue);
      this.gc.setBackground(YELLOW);
      Rectangle recError = new Rectangle(MARGIN+wr, y + (GAP/2), baselineErrorLength*2, BAR_HEIGHT);
      this.gc.fillRectangle(recError);
      Rectangle rec = new Rectangle(MARGIN, y + (GAP/2), baselineBarLength+baselineErrorLength, BAR_HEIGHT);
      this.gc.drawRectangle(rec);
      StringBuffer tooltip = new StringBuffer("Time for baseline build ");
      tooltip.append(baselineBuildResults.getName());
      tooltip.append(": ");
      tooltip.append(Util.timeString((long)baselineValue));
      tooltip.append(" [&#177;");
      tooltip.append(Util.timeString((long)baselineError));
      tooltip.append(']');
      graphArea.addArea(rec, tooltip.toString());
      labelxpos += baselineErrorLength;
    }

    // set current build bar color
    if (baselineValue < currentValue) {
      if (isCommented) {
        this.gc.setBackground(GRAY);
      } else  {
        this.gc.setBackground(failureColor);
      }
    } else {
      this.gc.setBackground(okColor);
    }

    // draw current build bar
    double currentGraphValue = kind == TIME_LOG ? Math.log(currentValue) : currentValue;
    int currentBarLength= (int) (currentGraphValue / max * this.graphWidth);
    int currentErrorLength= (int) (currentError / max * this.graphWidth / 2);
    if (kind == TIME_LOG || currentErrorLength <= 1) {
      this.gc.fillRectangle(MARGIN, y + (GAP/2) + BAR_HEIGHT, currentBarLength, BAR_HEIGHT);
      Rectangle rec = new Rectangle(MARGIN, y + (GAP/2) + BAR_HEIGHT, currentBarLength, BAR_HEIGHT);
      this.gc.drawRectangle(rec);
      String tooltip = "Time for current build "+currentBuildResults.getName()+": "+Util.timeString((long)currentValue);
      if (isCommented) {
        tooltip += ".    " + currentBuildResults.getComment();
      }
      graphArea.addArea(rec, tooltip);
      if (labelxpos < (MARGIN+currentBarLength)) {
        labelxpos = MARGIN + currentBarLength;
      }
    } else {
      int wr = currentBarLength - currentErrorLength;
      Rectangle recValue = new Rectangle(MARGIN, y + (GAP/2) + BAR_HEIGHT, wr, BAR_HEIGHT);
      this.gc.fillRectangle(recValue);
      this.gc.setBackground(YELLOW);
      Rectangle recError = new Rectangle(MARGIN+wr, y + (GAP/2) + BAR_HEIGHT, currentErrorLength*2, BAR_HEIGHT);
      this.gc.fillRectangle(recError);
      Rectangle rec = new Rectangle(MARGIN, y + (GAP/2) + BAR_HEIGHT, currentBarLength+currentErrorLength, BAR_HEIGHT);
      this.gc.drawRectangle(rec);
      StringBuffer tooltip = new StringBuffer("Time for current build ");
      tooltip.append(currentBuildResults.getName());
      tooltip.append(": ");
      tooltip.append(Util.timeString((long)currentValue));
      tooltip.append(" [&#177;");
      tooltip.append(Util.timeString((long)currentError));
      tooltip.append(']');
      if (isCommented) {
        tooltip.append(".    ");
        tooltip.append(currentBuildResults.getComment());
      }
      graphArea.addArea(rec, tooltip.toString());
      if (labelxpos < (MARGIN+currentBarLength+currentErrorLength)) {
        labelxpos = MARGIN + currentBarLength+currentErrorLength;
      }
    }

    // set delta value style and color
    boolean hasFailure = currentBuildResults.getFailure() != null;
    if (hasFailure) {
      if (isCommented) {
        this.gc.setForeground(DARK_GRAY);
      } else  {
        this.gc.setForeground(RED);
      }
    } else {
      this.gc.setForeground(BLACK);
    }

    // draw delta value
    double delta = -configResults.getDelta();
    String label = delta > 0 ? "+" : "";
    label += NUMBER_FORMAT.format(delta*100) + "%";
    Point labelExtent= this.gc.stringExtent(label);
    int labelvpos= y + (LINE_HEIGHT - labelExtent.y) / 2;
    this.gc.drawString(label, labelxpos+TGAP, labelvpos, true);
    this.gc.setForeground(BLACK);
    this.gc.setFont(null);
    int titleStart = (int) (RATIO * this.imageWidth);
    if (singleTest || !isSignificant) {
      String deltaTooltip = null;
      if (singleTest) {
        deltaTooltip = "This test performed only one iteration; hence its reliability cannot be assessed";
      } else if (!isSignificant) {
        deltaTooltip = "This test has a bad reliability: error is "+NUMBER_FORMAT.format(error*100)+"% (> 3%)!";
      }
      Image warning = (Image) this.resources.get("warning");
      int xi = labelxpos+TGAP+labelExtent.x;
      this.gc.drawImage(warning, xi, labelvpos);
      ImageData imageData = warning.getImageData();
      // Set zones
      // - first one is between end of bar and warning image beginning
      Rectangle deltaZone = new Rectangle(labelxpos, labelvpos-2, xi-labelxpos, labelExtent.y+4);
      graphArea.addArea(deltaZone, null);
      // - second one is the warning image
      Rectangle warningZone = new Rectangle(xi, labelvpos, imageData.width, imageData.height);
      graphArea.addArea(warningZone, deltaTooltip);
      // - last one is between end of the warning image and the scenario title beginning
      int warningImageEnd = xi+imageData.width;
      Rectangle emptyZone = new Rectangle(warningImageEnd, labelvpos, titleStart-warningImageEnd, imageData.height);
      graphArea.addArea(emptyZone, deltaTooltip);
    } else {
      // No tooltip => delta zone is between end of bar and the scenario title beginning
      Rectangle deltaZone = new Rectangle(labelxpos, labelvpos-2, titleStart-labelxpos, labelExtent.y+4);
      graphArea.addArea(deltaZone, null);
    }

    // set title style
    Color oldfg= this.gc.getForeground();
    this.gc.setForeground(BLUE);

    // draw scenario title
    int x= titleStart;
    ScenarioResults scenarioResults = (ScenarioResults) configResults.getParent();
    String title = scenarioResults.getLabel() + " (" + this.defaultDimName + ")";
    Point e= this.gc.stringExtent(title);
    this.gc.drawLine(x, labelvpos + e.y - 1, x + e.x, labelvpos + e.y - 1);
    this.gc.drawString(title, x, labelvpos, true);
    this.gc.setForeground(oldfg);
    this.gc.setFont(null);
    Rectangle titleZone = new Rectangle(x, labelvpos, e.x, e.y);
    graphArea.addArea(titleZone, null/*no tooltip*/);
    if (!configResults.isBaselined()) {
      Image warning = (Image) this.resources.get("warning");
      this.gc.drawImage(warning, x+e.x, labelvpos);
      ImageData imageData = warning.getImageData();
      Rectangle warningZone = new Rectangle(x+e.x, labelvpos, imageData.width, imageData.height);
      String titleTooltip =  "This test has no baseline result, hence use build "+configResults.getBaselineBuildName()+" for reference!";
      graphArea.addArea(warningZone, titleTooltip);
    }
  }
}
View Full Code Here

}

int initStatus(BuildResults buildResults) {
  this.status = READ;
  double buildValue = buildResults.getValue();
  ConfigResults configResults = (ConfigResults) buildResults.getParent();
  BuildResults baselineResults = configResults.getBaselineBuildResults(buildResults.getName());
  double baselineValue = baselineResults.getValue();
  double delta = (baselineValue - buildValue) / baselineValue;
  if (Double.isNaN(delta)) {
    this.status |= NO_BASELINE;
  }
View Full Code Here

/*
* Print a scenario line in the summary table.
*/
private void printSummaryScenarioLine(int i, String config, ScenarioResults scenarioResults, PrintStream stream) {
  ConfigResults configResults = scenarioResults.getConfigResults(config);
  if (configResults == null || !configResults.isValid()) {
    stream.print("<td>n/a</td>");
    return;
  }
  String url = config + "/" + scenarioResults.getFileName()+".html";
  double[] stats = null;
  if (i==0) { // baseline results
    List baselinePrefixes = new ArrayList();
    if (this.baselinePrefix == null) {
      baselinePrefixes.add(DB_Results.getDbBaselinePrefix());
    } else {
      baselinePrefixes.add(this.baselinePrefix);
    }
    stats = configResults.getStatistics(baselinePrefixes);
  } else {
    stats = configResults.getStatistics(this.currentBuildPrefixes);
  }
  double variation = stats[3];
  if (variation > 10 && variation < 20) {
    stream.print("<td bgcolor=\"yellow\">");
  } else if (variation >= 20) {
View Full Code Here

    BarGraph barGraph = null;
    List allResults = new ArrayList();
    String defaultDimName = DB_Results.getDefaultDimension().getName();
    for (int i=0, size=scenarios.size(); i<size; i++) {
      ScenarioResults scenarioResults = (ScenarioResults) scenarios.get(i);
      ConfigResults configResults = scenarioResults.getConfigResults(configName);
      if (configResults == null || !configResults.isValid()) continue;
      double[] results = configResults.getCurrentBuildDeltaInfo();
      double percent = -results[0] * 100.0;
      if (results != null && Math.abs(percent) < 200) {
        String name = scenarioResults.getLabel() + " (" + defaultDimName + ")";
        if (!configResults.getCurrentBuildName().equals(buildName)) {
          continue; // the test didn't run on last build, skip it
        }
        if (!configResults.isBaselined()) {
          name = "*" + name + " (" + configResults.getBaselineBuildName() + ")";
        }
        if (barGraph == null) {
          barGraph = new BarGraph(null);
        }
        barGraph.addItem(name,
            results,
            configName + "/" + scenarioResults.getFileName() + ".html",
            configResults.getCurrentBuildResults().getComment(),
            (Utils.confidenceLevel(results) & Utils.ERR) == 0);

        // add results
        allResults.add(configResults);
      }
View Full Code Here

TOP

Related Classes of org.eclipse.test.internal.performance.results.db.ConfigResults

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.