View | Details | Raw Unified | Return to bug 181718
Collapse All | Expand All

(-)src/org/eclipse/test/internal/performance/results/DB_Results.java (-4 / +33 lines)
Lines 24-29 Link Here
24
import java.util.Map;
24
import java.util.Map;
25
import java.util.StringTokenizer;
25
import java.util.StringTokenizer;
26
26
27
import org.eclipse.test.internal.performance.InternalDimensions;
27
import org.eclipse.test.internal.performance.PerformanceTestPlugin;
28
import org.eclipse.test.internal.performance.PerformanceTestPlugin;
28
import org.eclipse.test.internal.performance.db.DB;
29
import org.eclipse.test.internal.performance.db.DB;
29
30
Lines 688-697 Link Here
688
	internalQueryAllComments();
689
	internalQueryAllComments();
689
	ResultSet result = null;
690
	ResultSet result = null;
690
	try {
691
	try {
691
		String currentBuildName = currentBuild.getName();
692
		String cBuildName = currentBuild.getName();
692
		String baselineBuildName = baselineBuild.getName();
693
		String currentBuildName = cBuildName;
693
		result = fSQL.queryScenarioSummaries(scenarioResults.getId(), config, currentBuild.getName(), baselineBuild.getName());
694
		String bBuildName = baselineBuild.getName();
695
		String baselineBuildName = bBuildName;
696
		int scenarioID = scenarioResults.getId();
697
		// First try to get summaries of elapsed process dimension
698
		result = fSQL.queryScenarioSummaries(scenarioID, config, cBuildName, bBuildName, InternalDimensions.ELAPSED_PROCESS.getId());
699
		boolean hasResults = false;
694
		while (result.next()) {
700
		while (result.next()) {
701
			hasResults = true;
695
			String variation = result.getString(1);
702
			String variation = result.getString(1);
696
			int summaryKind = result.getShort(2);
703
			int summaryKind = result.getShort(2);
697
			int comment_id = result.getInt(3);
704
			int comment_id = result.getInt(3);
Lines 704-710 Link Here
704
			} else if (buildName.equals(baselineBuildName)) {
711
			} else if (buildName.equals(baselineBuildName)) {
705
				buildResults = baselineBuild;
712
				buildResults = baselineBuild;
706
			}
713
			}
707
			buildResults.setSummary(summaryKind, COMMENTS[comment_id]);
714
			if (buildResults != null) {
715
				buildResults.setSummary(summaryKind, COMMENTS[comment_id]);
716
			}
717
		}
718
		if (!hasResults) {
719
			// Scenario is not a fingerprint, try to get comments
720
			result = fSQL.queryScenarioSummaries(scenarioID, config, cBuildName, bBuildName, 0);
721
			while (result.next()) {
722
				String variation = result.getString(1);
723
				int comment_id = result.getInt(3);
724
				StringTokenizer tokenizer = new StringTokenizer(variation, "=|"); //$NON-NLS-1$
725
				tokenizer.nextToken(); 									// 'build'
726
				String buildName = tokenizer.nextToken();	// 'I20070615-1200'
727
				BuildResults buildResults = null;
728
				if (buildName.equals(currentBuildName)) {
729
					buildResults = currentBuild;
730
				} else if (buildName.equals(baselineBuildName)) {
731
					buildResults = baselineBuild;
732
				}
733
				if (buildResults != null) {
734
					buildResults.setComment(COMMENTS[comment_id]);
735
				}
736
			}
708
		}
737
		}
709
	} catch (SQLException e) {
738
	} catch (SQLException e) {
710
		PerformanceTestPlugin.log(e);
739
		PerformanceTestPlugin.log(e);
(-)src/org/eclipse/test/internal/performance/results/SQL_Results.java (-2 / +4 lines)
Lines 211-231 Link Here
211
 * @param scenarioID The id of the scenario
211
 * @param scenarioID The id of the scenario
212
 * @param currentBuildName The name of the current build
212
 * @param currentBuildName The name of the current build
213
 * @param baselineBuildName The name of the baseline build
213
 * @param baselineBuildName The name of the baseline build
214
 * @param dim_id The dim id
214
 * @return Set of the query result
215
 * @return Set of the query result
215
 * @throws SQLException
216
 * @throws SQLException
216
 */
217
 */
217
ResultSet queryScenarioSummaries(int scenarioID, String config, String currentBuildName, String baselineBuildName) throws SQLException {
218
ResultSet queryScenarioSummaries(int scenarioID, String config, String currentBuildName, String baselineBuildName, int dim_id) throws SQLException {
218
	if (this.queryScenarioSummaries == null) {
219
	if (this.queryScenarioSummaries == null) {
219
		this.queryScenarioSummaries= fConnection.prepareStatement("select KEYVALPAIRS, IS_GLOBAL, COMMENT_ID from VARIATION, SUMMARYENTRY where " + //$NON-NLS-1$
220
		this.queryScenarioSummaries= fConnection.prepareStatement("select KEYVALPAIRS, IS_GLOBAL, COMMENT_ID from VARIATION, SUMMARYENTRY where " + //$NON-NLS-1$
220
			"(KEYVALPAIRS like ? or KEYVALPAIRS like ?) and " + //$NON-NLS-1$
221
			"(KEYVALPAIRS like ? or KEYVALPAIRS like ?) and " + //$NON-NLS-1$
221
			"VARIATION_ID = VARIATION.ID and " + //$NON-NLS-1$
222
			"VARIATION_ID = VARIATION.ID and " + //$NON-NLS-1$
222
			"SCENARIO_ID = ? and " + //$NON-NLS-1$
223
			"SCENARIO_ID = ? and " + //$NON-NLS-1$
223
			"DIM_ID = " + InternalDimensions.ELAPSED_PROCESS.getId() + //$NON-NLS-1$
224
			"DIM_ID = ? " + //$NON-NLS-1$
224
			" order by VARIATION_ID"); //$NON-NLS-1$
225
			" order by VARIATION_ID"); //$NON-NLS-1$
225
	}
226
	}
226
	this.queryScenarioSummaries.setString(1, "|build=" + currentBuildName+ "||config="+ config + "||jvm=sun|"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
227
	this.queryScenarioSummaries.setString(1, "|build=" + currentBuildName+ "||config="+ config + "||jvm=sun|"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
227
	this.queryScenarioSummaries.setString(2, "|build=" + baselineBuildName+ "||config="+ config + "||jvm=sun|"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
228
	this.queryScenarioSummaries.setString(2, "|build=" + baselineBuildName+ "||config="+ config + "||jvm=sun|"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
228
	this.queryScenarioSummaries.setInt(3, scenarioID);
229
	this.queryScenarioSummaries.setInt(3, scenarioID);
230
	this.queryScenarioSummaries.setInt(4, dim_id);
229
	return this.queryScenarioSummaries.executeQuery();
231
	return this.queryScenarioSummaries.executeQuery();
230
}
232
}
231
233
(-)src/org/eclipse/test/internal/performance/results/BuildResults.java (-1 / +12 lines)
Lines 128-134 Link Here
128
		} else {
128
		} else {
129
			char first = this.name.charAt(0);
129
			char first = this.name.charAt(0);
130
			if (first == 'N' || first == 'I' || first == 'M') { // TODO (frederic) should be buildIdPrefixes...
130
			if (first == 'N' || first == 'I' || first == 'M') { // TODO (frederic) should be buildIdPrefixes...
131
				this.date = this.name.substring(1, 9)+this.name.substring(10, 14);
131
				if (this.name.length() == 14) {
132
					this.date = this.name.substring(1, 9)+this.name.substring(10, 14);
133
				} else {
134
					this.date = this.name.substring(1);
135
				}
132
			} else {
136
			} else {
133
				int length = this.name.length() - 12 /* length of date */;
137
				int length = this.name.length() - 12 /* length of date */;
134
				for (int i=0; i<=length; i++) {
138
				for (int i=0; i<=length; i++) {
Lines 317-322 Link Here
317
/*
321
/*
318
 * Set the build summary and its associated comment.
322
 * Set the build summary and its associated comment.
319
 */
323
 */
324
void setComment(String comment) {
325
	this.comment = comment;
326
}
327
328
/*
329
 * Set the build summary and its associated comment.
330
 */
320
void setSummary(int kind, String comment) {
331
void setSummary(int kind, String comment) {
321
	this.comment = comment;
332
	this.comment = comment;
322
	this.summaryKind = kind;
333
	this.summaryKind = kind;
(-)src/org/eclipse/test/internal/performance/InternalPerformanceMeter.java (-1 / +4 lines)
Lines 85-92 Link Here
85
	public void commit() {
85
	public void commit() {
86
		Sample sample= getSample();
86
		Sample sample= getSample();
87
		if (sample != null) {
87
		if (sample != null) {
88
			if (fSummaryDimensions != null)
88
			if (fSummaryDimensions != null) {
89
				sample.tagAsSummary(fSummaryIsGlobal, fShortName, fSummaryDimensions, fCommentType, fComment);
89
				sample.tagAsSummary(fSummaryIsGlobal, fShortName, fSummaryDimensions, fCommentType, fComment);
90
			} else if (this.fComment != null) {
91
				sample.setComment(this.fCommentType, this.fComment);
92
			}
90
			Variations variations= PerformanceTestPlugin.getVariations();
93
			Variations variations= PerformanceTestPlugin.getVariations();
91
			if (variations != null)
94
			if (variations != null)
92
				DB.store(variations, sample);
95
				DB.store(variations, sample);
(-)src/org/eclipse/test/internal/performance/db/DB.java (-1 / +17 lines)
Lines 339-344 Link Here
339
                String shortName= sample.getShortname();
339
                String shortName= sample.getShortname();
340
                if (shortName != null)
340
                if (shortName != null)
341
                    fSQL.setScenarioShortName(scenario_id, shortName);
341
                    fSQL.setScenarioShortName(scenario_id, shortName);
342
            } else {
343
                
344
                int commentId= 0;
345
                int commentKind= sample.getCommentType();
346
                String comment= sample.getComment();
347
                if (commentKind == Performance.EXPLAINS_DEGRADATION_COMMENT && comment != null)
348
                		commentId= fSQL.getCommentId(commentKind, comment);
349
                
350
                Dimension[] summaryDimensions= sample.getSummaryDimensions();
351
                for (int i= 0; i < summaryDimensions.length; i++) {
352
                    Dimension dimension= summaryDimensions[i];
353
                    if (dimension instanceof Dim)
354
                        fSQL.createSummaryEntry(variation_id, scenario_id, 0/*invalid dim id*/, false, commentId);
355
                }
342
            }
356
            }
343
            int sample_id= fSQL.createSample(variation_id, scenario_id, new Timestamp(sample.getStartTime()));
357
            int sample_id= fSQL.createSample(variation_id, scenario_id, new Timestamp(sample.getStartTime()));
344
358
Lines 553-559 Link Here
553
                			comment= rs2.getString(2);
567
                			comment= rs2.getString(2);
554
                		}
568
                		}
555
                }
569
                }
556
                fingerprints.add(new SummaryEntry(scenarioName, shortName, Dim.getDimension(dim_id), isGlobal, commentKind, comment));
570
                if (dim_id != 0) {
571
	                fingerprints.add(new SummaryEntry(scenarioName, shortName, Dim.getDimension(dim_id), isGlobal, commentKind, comment));
572
                }
557
            }
573
            }
558
            return (SummaryEntry[])fingerprints.toArray(new SummaryEntry[fingerprints.size()]);
574
            return (SummaryEntry[])fingerprints.toArray(new SummaryEntry[fingerprints.size()]);
559
        } catch (SQLException e) {
575
        } catch (SQLException e) {
(-)src/org/eclipse/test/internal/performance/data/Sample.java (+5 lines)
Lines 45-50 Link Here
45
    public Sample(DataPoint[] dataPoints) {
45
    public Sample(DataPoint[] dataPoints) {
46
        fDataPoints= dataPoints;
46
        fDataPoints= dataPoints;
47
    }
47
    }
48
49
    public void setComment(int commentType, String comment) {
50
        fCommentType= commentType;
51
        fComment= comment;
52
    }
48
    
53
    
49
    public void tagAsSummary(boolean global, String shortName, Dimension[] summaryDimensions, int commentType, String comment) {
54
    public void tagAsSummary(boolean global, String shortName, Dimension[] summaryDimensions, int commentType, String comment) {
50
        fIsSummary= true;
55
        fIsSummary= true;

Return to bug 181718