SamplingStatCalculator row = null; final String sampleLabel = res.getSampleLabel(useGroupName.isSelected()); synchronized (tableRows) { row = (SamplingStatCalculator) tableRows.get(sampleLabel); if (row == null) { row = new SamplingStatCalculator(sampleLabel); tableRows.put(row.getLabel(), row); model.insertRow(row, model.getRowCount() - 1); } } /* * Synch is needed because multiple threads can update the counts. */ synchronized(row) { row.addSample(res); } SamplingStatCalculator tot = (SamplingStatCalculator) tableRows.get(TOTAL_ROW_LABEL); synchronized(tot) { tot.addSample(res); } model.fireTableDataChanged();
Calculator row = null; final String sampleLabel = res.getSampleLabel(useGroupName.isSelected()); synchronized (tableRows) { row = (Calculator) tableRows.get(sampleLabel); if (row == null) { row = new Calculator(sampleLabel); tableRows.put(row.getLabel(), row); model.insertRow(row, model.getRowCount() - 1); } } /* * Synch is needed because multiple threads can update the counts. */ synchronized(row) { row.addSample(res); } Calculator tot = ((Calculator) tableRows.get(TOTAL_ROW_LABEL)); synchronized(tot) { tot.addSample(res); } model.fireTableDataChanged();
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/StatVisualizer.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/SummaryReport.java
Method name: void add(SampleResult) Method name: void add(SampleResult)
Number of AST nodes: 14 Number of AST nodes: 14
1
SamplingStatCalculator row = null;
1
Calculator row = null;
2
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
2
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
3
		synchronized (tableRows) {
3
		synchronized (tableRows) {
4
            row = (SamplingStatCalculator) tableRows.get(sampleLabel);
4
            row = (Calculator) tableRows.get(sampleLabel);
5
			if (row == null) {
5
			if (row == null) {
6
				row = new SamplingStatCalculator(sampleLabel);
6
				row = new Calculator(sampleLabel);
7
				tableRows.put(row.getLabel(), row);
7
				tableRows.put(row.getLabel(), row);
8
				model.insertRow(row, model.getRowCount() - 1);
8
				model.insertRow(row, model.getRowCount() - 1);
9
			}
9
			}
10
		}
10
		}
11
        /*
12
        
11
		/*
13
 * Synch is needed because multiple threads can update the counts.
12
		 * Synch is needed because multiple threads can update the counts.
14
         */
15
        
13
		 */
16
synchronized(row) { 
14
		synchronized(row) {
17
            row.addSample(res);
15
		    row.addSample(res);
18
        }
19
		SamplingStat
16
		}
20
Calculator tot = (SamplingStatCalculator) tableRows.get(TOTAL_ROW_LABEL);
17
		Calculator tot = ((Calculator) tableRows.get(TOTAL_ROW_LABEL));
21
		synchronized(tot) {
18
		synchronized(tot) {
22
		    tot.addSample(res);
19
		    tot.addSample(res);
23
		}
20
		}
24
		model.fireTableDataChanged();
21
		model.fireTableDataChanged();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes having the same super class
Number of node comparisons49
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)5.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    SamplingStatCalculator row = null;
    1
    Calculator row = null;
    2
    final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
    2
    final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
    3
    synchronized (tableRows)
    3
    synchronized (tableRows)
    4
    row = (SamplingStatCalculator)tableRows.get(sampleLabel);
    4
    row = (Calculator)tableRows.get(sampleLabel);
    5
    if (row == null)
    5
    if (row == null)
    6
    row = new SamplingStatCalculator(sampleLabel);
    6
    row = new Calculator(sampleLabel);
    7
    tableRows.put(row.getLabel(), row);
    7
    tableRows.put(row.getLabel(), row);
    8
    model.insertRow(row, model.getRowCount() - 1);
    8
    model.insertRow(row, model.getRowCount() - 1);
    9
    synchronized (row)
    9
    synchronized (row)
                                                  
    10
    row.addSample(res);
    10
    row.addSample(res);
                                                  
    11
    SamplingStatCalculator tot = (SamplingStatCalculator)tableRows.get(TOTAL_ROW_LABEL);
    11
    SamplingStatCalculator tot = (SamplingStatCalculator)tableRows.get(TOTAL_ROW_LABEL);
    11
    Calculator tot = ((Calculator)tableRows.get(TOTAL_ROW_LABEL));
    Differences
    Expression1Expression2Difference
    (SamplingStatCalculator)tableRows.get(TOTAL_ROW_LABEL)((Calculator)tableRows.get(TOTAL_ROW_LABEL))TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (SamplingStatCalculator)tableRows.get(TOTAL_ROW_LABEL) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((Calculator)tableRows.get(TOTAL_ROW_LABEL)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    Calculator tot = ((Calculator)tableRows.get(TOTAL_ROW_LABEL));
    12
    synchronized (tot)
    12
    synchronized (tot)
                                                  
    13
    tot.addSample(res);
    13
    tot.addSample(res);
                                                  
    14
    model.fireTableDataChanged();
    14
    model.fireTableDataChanged();
    Precondition Violations (3)
    Row Violation
    1Expression (SamplingStatCalculator)tableRows.get(TOTAL_ROW_LABEL) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((Calculator)tableRows.get(TOTAL_ROW_LABEL)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables row, tot , while Clone fragment #2 returns variables row, tot