Use the scale in the var name.
This commit is contained in:
parent
3e27e51770
commit
de3614e3dc
|
@ -99,21 +99,21 @@ public class CharUtilsPerfRun {
|
||||||
|
|
||||||
private void run() {
|
private void run() {
|
||||||
this.printSysInfo();
|
this.printSysInfo();
|
||||||
long start;
|
long startMillis;
|
||||||
start = System.currentTimeMillis();
|
startMillis = System.currentTimeMillis();
|
||||||
this.printlnTotal("Do nothing", start);
|
this.printlnTotal("Do nothing", startMillis);
|
||||||
run_CharUtils_isAsciiNumeric(WARM_UP);
|
run_CharUtils_isAsciiNumeric(WARM_UP);
|
||||||
start = System.currentTimeMillis();
|
startMillis = System.currentTimeMillis();
|
||||||
run_CharUtils_isAsciiNumeric(COUNT);
|
run_CharUtils_isAsciiNumeric(COUNT);
|
||||||
this.printlnTotal("run_CharUtils_isAsciiNumeric", start);
|
this.printlnTotal("run_CharUtils_isAsciiNumeric", startMillis);
|
||||||
run_inlined_CharUtils_isAsciiNumeric(WARM_UP);
|
run_inlined_CharUtils_isAsciiNumeric(WARM_UP);
|
||||||
start = System.currentTimeMillis();
|
startMillis = System.currentTimeMillis();
|
||||||
run_inlined_CharUtils_isAsciiNumeric(COUNT);
|
run_inlined_CharUtils_isAsciiNumeric(COUNT);
|
||||||
this.printlnTotal("run_inlined_CharUtils_isAsciiNumeric", start);
|
this.printlnTotal("run_inlined_CharUtils_isAsciiNumeric", startMillis);
|
||||||
run_CharSet(WARM_UP);
|
run_CharSet(WARM_UP);
|
||||||
start = System.currentTimeMillis();
|
startMillis = System.currentTimeMillis();
|
||||||
run_CharSet(COUNT);
|
run_CharSet(COUNT);
|
||||||
this.printlnTotal("run_CharSet", start);
|
this.printlnTotal("run_CharSet", startMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int run_CharSet(final int loopCount) {
|
private int run_CharSet(final int loopCount) {
|
||||||
|
@ -149,8 +149,8 @@ public class CharUtilsPerfRun {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printlnTotal(final String prefix, final long start) {
|
private void printlnTotal(final String prefix, final long startMillis) {
|
||||||
final long total = System.currentTimeMillis() - start;
|
final long totalMillis = System.currentTimeMillis() - startMillis;
|
||||||
System.out.println(prefix + ": " + NumberFormat.getInstance().format(total) + " milliseconds.");
|
System.out.println(prefix + ": " + NumberFormat.getInstance().format(totalMillis) + " milliseconds.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,9 +142,9 @@ public class RandomStringUtilsTest {
|
||||||
assertEquals(50, r2.length(), "random(50) length");
|
assertEquals(50, r2.length(), "random(50) length");
|
||||||
assertTrue(!r1.equals(r2), "!r1.equals(r2)");
|
assertTrue(!r1.equals(r2), "!r1.equals(r2)");
|
||||||
|
|
||||||
final long seed = System.currentTimeMillis();
|
final long seedMillis = System.currentTimeMillis();
|
||||||
r1 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seed));
|
r1 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seedMillis));
|
||||||
r2 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seed));
|
r2 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seedMillis));
|
||||||
assertEquals(r1, r2, "r1.equals(r2)");
|
assertEquals(r1, r2, "r1.equals(r2)");
|
||||||
|
|
||||||
r1 = RandomStringUtils.random(0);
|
r1 = RandomStringUtils.random(0);
|
||||||
|
@ -153,8 +153,8 @@ public class RandomStringUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLANG805() {
|
public void testLANG805() {
|
||||||
final long seed = System.currentTimeMillis();
|
final long seedMillis = System.currentTimeMillis();
|
||||||
assertEquals("aaa", RandomStringUtils.random(3, 0, 0, false, false, new char[]{'a'}, new Random(seed)));
|
assertEquals("aaa", RandomStringUtils.random(3, 0, 0, false, false, new char[]{'a'}, new Random(seedMillis)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class LockingVisitorsTest {
|
||||||
final boolean[] booleanValues, final LockVisitor<boolean[], ?> visitor) throws InterruptedException {
|
final boolean[] booleanValues, final LockVisitor<boolean[], ?> visitor) throws InterruptedException {
|
||||||
final boolean[] runningValues = new boolean[10];
|
final boolean[] runningValues = new boolean[10];
|
||||||
|
|
||||||
final long startTime = System.currentTimeMillis();
|
final long startTimeMillis = System.currentTimeMillis();
|
||||||
for (int i = 0; i < booleanValues.length; i++) {
|
for (int i = 0; i < booleanValues.length; i++) {
|
||||||
final int index = i;
|
final int index = i;
|
||||||
final FailableConsumer<boolean[], ?> consumer = b -> {
|
final FailableConsumer<boolean[], ?> consumer = b -> {
|
||||||
|
@ -70,12 +70,12 @@ public class LockingVisitorsTest {
|
||||||
while (containsTrue(runningValues)) {
|
while (containsTrue(runningValues)) {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
final long endTime = System.currentTimeMillis();
|
final long endTimeMillis = System.currentTimeMillis();
|
||||||
for (final boolean booleanValue : booleanValues) {
|
for (final boolean booleanValue : booleanValues) {
|
||||||
assertTrue(booleanValue);
|
assertTrue(booleanValue);
|
||||||
}
|
}
|
||||||
// WRONG assumption
|
// WRONG assumption
|
||||||
// runTimeCheck.accept(endTime - startTime);
|
// runTimeCheck.accept(endTimeMillis - startTimeMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void set(final boolean[] booleanArray, final int offset, final boolean value) {
|
protected void set(final boolean[] booleanArray, final int offset, final boolean value) {
|
||||||
|
|
|
@ -262,13 +262,13 @@ public class FastDateFormatTest {
|
||||||
try {
|
try {
|
||||||
final Date date = new Date();
|
final Date date = new Date();
|
||||||
|
|
||||||
final long t0 = System.currentTimeMillis();
|
final long t0Millis = System.currentTimeMillis();
|
||||||
final String formattedDate = printer.format(date);
|
final String formattedDate = printer.format(date);
|
||||||
totalElapsed.addAndGet(0, System.currentTimeMillis() - t0);
|
totalElapsed.addAndGet(0, System.currentTimeMillis() - t0Millis);
|
||||||
|
|
||||||
final long t1 = System.currentTimeMillis();
|
final long t1Millis = System.currentTimeMillis();
|
||||||
final Object pd = parser.parseObject(formattedDate);
|
final Object pd = parser.parseObject(formattedDate);
|
||||||
totalElapsed.addAndGet(1, System.currentTimeMillis() - t1);
|
totalElapsed.addAndGet(1, System.currentTimeMillis() - t1Millis);
|
||||||
|
|
||||||
if (!date.equals(pd)) {
|
if (!date.equals(pd)) {
|
||||||
failures.incrementAndGet();
|
failures.incrementAndGet();
|
||||||
|
|
|
@ -174,14 +174,14 @@ public class StopWatchTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetStartTime() {
|
public void testGetStartTime() {
|
||||||
final long beforeStopWatch = System.currentTimeMillis();
|
final long beforeStopWatchMillis = System.currentTimeMillis();
|
||||||
final StopWatch watch = new StopWatch();
|
final StopWatch watch = new StopWatch();
|
||||||
assertThrows(IllegalStateException.class, watch::getStartTime,
|
assertThrows(IllegalStateException.class, watch::getStartTime,
|
||||||
"Calling getStartTime on an unstarted StopWatch should throw an exception");
|
"Calling getStartTime on an unstarted StopWatch should throw an exception");
|
||||||
watch.start();
|
watch.start();
|
||||||
|
|
||||||
watch.getStartTime();
|
watch.getStartTime();
|
||||||
assertTrue(watch.getStartTime() >= beforeStopWatch);
|
assertTrue(watch.getStartTime() >= beforeStopWatchMillis);
|
||||||
|
|
||||||
watch.reset();
|
watch.reset();
|
||||||
assertThrows(IllegalStateException.class, watch::getStartTime,
|
assertThrows(IllegalStateException.class, watch::getStartTime,
|
||||||
|
|
Loading…
Reference in New Issue