if (counter == 0) {
return 0.0; // Better behaviour when howLong=0 or lastTime=0
}
long howLongRunning = lastTime - firstTime;
if (howLongRunning == 0) {
return Double.MAX_VALUE;
}
return (double) counter / howLongRunning * 1000.0;
if (counter == 0) {
return 0.0; // Better behaviour when howLong=0 or lastTime=0
}
long howLongRunning = lastTime - firstTime;
if (howLongRunning == 0) {
return Double.MAX_VALUE;
}
return (double) counter / howLongRunning * 60000.0;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/RunningSample.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/RunningSample.java
|
Method name: double getRate()
|
|
Method name: double getRatePerMin()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (counter == 0) {↵ | | 1 | if (counter == 0) {↵
|
2 | return 0.0; // Better behaviour when howLong=0 or lastTime=0↵ | | 2 | return 0.0; // Better behaviour when howLong=0 or lastTime=0↵
|
3 | }↵ | | 3 | }↵
|
|
4 | long howLongRunning = lastTime - firstTime;↵ | | 4 | long howLongRunning = lastTime - firstTime;↵
|
|
5 | if (howLongRunning == 0) {↵ | | 5 | if (howLongRunning == 0) {↵
|
6 | return Double.MAX_VALUE;↵ | | 6 | return Double.MAX_VALUE;↵
|
7 | }↵ | | 7 | }↵
|
|
8 | return (double) counter / howLongRunning * 1000.0; | | 8 | return (double) counter / howLongRunning * 60000.0;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (counter == 0) | | 1 | if (counter == 0) |
2 | | | 2 | |
3 | long howLongRunning = lastTime - firstTime; | | 3 | long howLongRunning = lastTime - firstTime; |
4 | if (howLongRunning == 0) | | 4 | if (howLongRunning == 0) |
5 | | | 5 | |
6 | return (double)counter / howLongRunning * 1000.0; | | 6 | return (double)counter / howLongRunning * 60000.0; |
Precondition Violations (0)
Row |
Violation |