@Test public void useLogElapsedNanotime() throws Exception { long begin = System.nanoTime(); TimeUnit.NANOSECONDS.sleep(50); DebugUtils.logElapsedNanotime(begin, "com.orientsec.grpc.common.util.DebugUtilsTest.logElapsedNanotime"); }
public static void logElapsedNanotime(long beginNanos, String functionDesc) { if (!DEBUG) { return; } long end = System.nanoTime(); double elapsed = (double) (end - beginNanos) / 1000000; if (elapsed <= 0) { return; } String message = LOG_PREFIX + "功能[" + functionDesc + "]消耗的时间为[" + elapsed + "]毫秒"; logger.info(message); }
DebugUtils { public static void logElapsedNanotime(long beginNanos, String functionDesc) { if (!DEBUG) { return; } long end = System.nanoTime(); double elapsed = (double) (end - beginNanos) / 1000000; if (elapsed <= 0) { return; } String message = LOG_PREFIX + "功能[" + functionDesc + "]消耗的时间为[" + elapsed + "]毫秒"; logger.info(message); } }
DebugUtils { public static void logElapsedNanotime(long beginNanos, String functionDesc) { if (!DEBUG) { return; } long end = System.nanoTime(); double elapsed = (double) (end - beginNanos) / 1000000; if (elapsed <= 0) { return; } String message = LOG_PREFIX + "功能[" + functionDesc + "]消耗的时间为[" + elapsed + "]毫秒"; logger.info(message); }  }
DebugUtils { public static void logElapsedNanotime(long beginNanos, String functionDesc) { if (!DEBUG) { return; } long end = System.nanoTime(); double elapsed = (double) (end - beginNanos) / 1000000; if (elapsed <= 0) { return; } String message = LOG_PREFIX + "功能[" + functionDesc + "]消耗的时间为[" + elapsed + "]毫秒"; logger.info(message); }  static void logElapsedTime(long beginMillis, String functionDesc); static void logElapsedNanotime(long beginNanos, String functionDesc); }
DebugUtils { public static void logElapsedNanotime(long beginNanos, String functionDesc) { if (!DEBUG) { return; } long end = System.nanoTime(); double elapsed = (double) (end - beginNanos) / 1000000; if (elapsed <= 0) { return; } String message = LOG_PREFIX + "功能[" + functionDesc + "]消耗的时间为[" + elapsed + "]毫秒"; logger.info(message); }  static void logElapsedTime(long beginMillis, String functionDesc); static void logElapsedNanotime(long beginNanos, String functionDesc); static final boolean DEBUG; }