/* * Read the build results data from the given stream. */ void readData(DataInputStream stream) throws IOException { long timeBuild = stream.readLong(); this.date = new Long(timeBuild).toString(); byte kind = stream.readByte(); this.baseline = kind == 0; if (this.baseline) { this.name = getPerformance().baselinePrefix + '_' + this.date; } else { String suffix = this.date.substring(0, 8) + '-' + this.date.substring(8); switch (kind) { case 1: this.name = "N" + suffix; // $NON-NLS-1$ break; case 2: this.name = "I" + suffix; // $NON-NLS-1$ break; case 3: this.name = "M" + suffix; // $NON-NLS-1$ break; default: this.name = stream.readUTF(); break; } } int length = stream.readInt(); this.dimensions = new Dim[length]; this.average = new double[length]; this.stddev = new double[length]; this.count = new long[length]; for (int i = 0; i < length; i++) { this.dimensions[i] = getDimension(stream.readInt()); this.average[i] = stream.readLong(); this.count[i] = stream.readLong(); this.stddev[i] = stream.readDouble(); } this.id = DB_Results.getBuildId(this.name); // read summary this.summaryKind = stream.readInt(); // read comment String str = stream.readUTF(); if (str.length() > 0) { this.comment = str; } }
private String lastBuildName(int kind) { String[] builds = getAllSortedBuildNames(); int idx = builds.length - 1; String lastBuildName = builds[idx--]; switch (kind) { case 1: // no ref while (lastBuildName.startsWith(DB_Results.getDbBaselinePrefix())) { lastBuildName = builds[idx--]; } break; case 2: // only I-build or M-build char ch = lastBuildName.charAt(0); while (ch != 'I' && ch != 'M') { lastBuildName = builds[idx--]; ch = lastBuildName.charAt(0); } break; default: break; } return lastBuildName; }
/** * Get all results numbers for a given machine of the current component. * * @param configName The name of the configuration to get numbers * @param fingerprints Set whether only fingerprints scenario should be taken into account * @return A list of lines. Each line represent a build and is a list of either strings or values. * Values are an array of double: * <ul> * <li>{@link #BUILD_VALUE_INDEX}: the build value in milliseconds * <li>{@link #BASELINE_VALUE_INDEX}: the baseline value in milliseconds * <li>{@link #DELTA_VALUE_INDEX}: the difference between the build value and its more * recent baseline * <li>{@link #DELTA_ERROR_INDEX}: the error made while computing the difference * <li>{@link #BUILD_ERROR_INDEX}: the error made while measuring the build value * <li>{@link #BASELINE_ERROR_INDEX}: the error made while measuring the baseline value * </ul> */ public List getConfigNumbers(String configName, boolean fingerprints, List differences) { // Initialize lists AbstractResults[] scenarios = getChildren(); int length = scenarios.length; // Print scenario names line List firstLine = new ArrayList(); for (int i = 0; i < length; i++) { ScenarioResults scenarioResults = (ScenarioResults) scenarios[i]; if (!fingerprints || scenarioResults.hasSummary()) { firstLine.add(scenarioResults.getName()); } } // Print each build line String[] builds = getAllSortedBuildNames(true /*descending order*/); // int milestoneIndex = 0; // String milestoneDate = Util.getMilestoneDate(milestoneIndex); String currentBuildName = null; int buildsLength = builds.length; firstLine.add(0, new Integer(buildsLength)); differences.add(firstLine); for (int i = 0; i < buildsLength; i++) { List line = new ArrayList(); String buildName = builds[i]; line.add(buildName); if (!buildName.startsWith(DB_Results.getDbBaselinePrefix())) { for (int j = 0; j < length; j++) { ScenarioResults scenarioResults = (ScenarioResults) scenarios[j]; if (!fingerprints || scenarioResults.hasSummary()) { ConfigResults configResults = scenarioResults.getConfigResults(configName); BuildResults buildResults = configResults == null ? null : configResults.getBuildResults(buildName); if (buildResults == null) { // no result for this scenario in this build line.add(NO_BUILD_RESULTS); } else { getConfigNumbers( buildResults, configResults.getBaselineBuildResults(buildName), line); } } } differences.add(line); if (currentBuildName != null && currentBuildName.charAt(0) != 'N') {} currentBuildName = buildName; } // if (milestoneDate != null) { // update previous builds // int dateComparison = milestoneDate.compareTo(Util.getBuildDate(buildName)); // if (dateComparison <= 0) { // if (dateComparison == 0) { // } // if (++milestoneIndex == Util.MILESTONES.length) { // milestoneDate = null; // } else { // milestoneDate = Util.getMilestoneDate(milestoneIndex); // } // } // } } // Write differences lines int last = buildsLength - 1; String lastBuildName = builds[last]; while (last > 0 && lastBuildName.startsWith(DB_Results.getDbBaselinePrefix())) { lastBuildName = builds[--last]; } // appendDifferences(lastBuildName, configName, previousMilestoneName, differences, // fingerprints); // appendDifferences(lastBuildName, configName, previousBuildName, differences, fingerprints); // Return the computed differences return differences; }
BuildResults(AbstractResults parent, int id) { super(parent, id); this.name = DB_Results.getBuildName(id); this.baseline = this.name.startsWith(VERSION_REF); }