mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
remove TimeInterval
This commit is contained in:
@@ -313,19 +313,6 @@ public class DateUtilTest {
|
||||
Assert.assertEquals("31天1小时21分", formatBetween);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timerTest() {
|
||||
final TimeInterval timer = DateUtil.timer();
|
||||
|
||||
// ---------------------------------
|
||||
// -------这是执行过程
|
||||
// ---------------------------------
|
||||
|
||||
timer.interval();// 花费毫秒数
|
||||
timer.intervalRestart();// 返回花费时间,并重置开始时间
|
||||
timer.intervalMinute();// 花费分钟数
|
||||
}
|
||||
|
||||
@Test
|
||||
public void currentTest() {
|
||||
final long current = DateUtil.current();
|
||||
|
@@ -1,20 +0,0 @@
|
||||
package cn.hutool.core.date;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TimeIntervalTest {
|
||||
@Test
|
||||
public void intervalGroupTest(){
|
||||
final TimeInterval timer = new TimeInterval();
|
||||
timer.start("1");
|
||||
ThreadUtil.sleep(800);
|
||||
timer.start("2");
|
||||
ThreadUtil.sleep(900);
|
||||
|
||||
|
||||
Console.log("Timer 1 took {} ms", timer.intervalMs("1"));
|
||||
Console.log("Timer 2 took {} ms", timer.intervalMs("2"));
|
||||
}
|
||||
}
|
@@ -1,7 +1,6 @@
|
||||
package cn.hutool.core.reflect;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.date.StopWatch;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.test.bean.ExamInfoDict;
|
||||
import cn.hutool.core.text.StrUtil;
|
||||
@@ -88,18 +87,20 @@ public class MethodUtilTest {
|
||||
// 预热
|
||||
getMethodWithReturnTypeCheck(ReflectUtilTest.TestBenchClass.class, false, "getH");
|
||||
|
||||
final TimeInterval timer = DateUtil.timer();
|
||||
final StopWatch timer = new StopWatch();
|
||||
timer.start();
|
||||
for (int i = 0; i < 100000000; i++) {
|
||||
MethodUtil.getMethod(ReflectUtilTest.TestBenchClass.class, false, "getH");
|
||||
}
|
||||
Console.log(timer.interval());
|
||||
timer.stop();
|
||||
Console.log(timer.getLastTaskTimeMillis());
|
||||
|
||||
timer.restart();
|
||||
timer.start();
|
||||
for (int i = 0; i < 100000000; i++) {
|
||||
getMethodWithReturnTypeCheck(ReflectUtilTest.TestBenchClass.class, false, "getH");
|
||||
}
|
||||
Console.log(timer.interval());
|
||||
timer.stop();
|
||||
Console.log(timer.getLastTaskTimeMillis());
|
||||
}
|
||||
|
||||
public static Method getMethodWithReturnTypeCheck(final Class<?> clazz, final boolean ignoreCase, final String methodName, final Class<?>... paramTypes) throws SecurityException {
|
||||
|
@@ -2,11 +2,11 @@ package cn.hutool.core.util;
|
||||
|
||||
import cn.hutool.core.collection.ConcurrentHashSet;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.date.StopWatch;
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.id.Snowflake;
|
||||
import cn.hutool.core.lang.id.IdUtil;
|
||||
import cn.hutool.core.lang.id.Snowflake;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
@@ -48,18 +48,21 @@ public class IdUtilTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void benchTest() {
|
||||
final TimeInterval timer = DateUtil.timer();
|
||||
final StopWatch timer = DateUtil.createStopWatch();
|
||||
timer.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
IdUtil.simpleUUID();
|
||||
}
|
||||
Console.log(timer.interval());
|
||||
timer.stop();
|
||||
Console.log(timer.getLastTaskTimeMillis());
|
||||
|
||||
timer.restart();
|
||||
timer.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
UUID.randomUUID().toString().replace("-", "");
|
||||
}
|
||||
Console.log(timer.interval());
|
||||
timer.stop();
|
||||
Console.log(timer.getLastTaskTimeMillis());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user