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