@Test public void testTimer() { ParsecAsyncProgress progress = new ParsecAsyncProgress(); ParsecAsyncProgressTimer.progressTime(progress, ParsecAsyncProgressTimer.TimerOpCode.TIMER_STARTSINGLE); ParsecAsyncProgressTimer.progressTime(progress, ParsecAsyncProgressTimer.TimerOpCode.TIMER_NAMELOOKUP); ParsecAsyncProgressTimer.progressTime(progress, ParsecAsyncProgressTimer.TimerOpCode.TIMER_CONNECT); ParsecAsyncProgressTimer.progressTime(progress, ParsecAsyncProgressTimer.TimerOpCode.TIMER_PRETRANSFER); ParsecAsyncProgressTimer.progressTime(progress, ParsecAsyncProgressTimer.TimerOpCode.TIMER_STARTTRANSFER); ParsecAsyncProgressTimer.progressTime(progress, ParsecAsyncProgressTimer.TimerOpCode.TIMER_TOTAL); assertTrue(progress.getNsLookupTime() > 0); assertTrue(progress.getConnectTime() > progress.getNsLookupTime()); assertTrue(progress.getPreTransferTime() > progress.getConnectTime()); assertTrue(progress.getStartTransferTime() > progress.getPreTransferTime()); assertTrue(progress.getTotalTime() > progress.getStartTransferTime()); }
public static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode) { long now = System.nanoTime() / DateUtils.MILLIS_PER_SECOND; switch (opCode) { case TIMER_STARTSINGLE: progress.setStartSingleTime(now); break; case TIMER_NAMELOOKUP: progress.setNsLookupTime(now - progress.getStartSingleTime()); break; case TIMER_CONNECT: progress.setConnectTime(now - progress.getStartSingleTime()); break; case TIMER_STARTTRANSFER: progress.setStartTransferTime(now - progress.getStartSingleTime()); break; case TIMER_PRETRANSFER: progress.setPreTransferTime(now - progress.getStartSingleTime()); break; case TIMER_TOTAL: progress.setTotalTime(now - progress.getStartSingleTime()); break; default: LOGGER.warn("opcode=" + opCode + " is not defined"); break; } }
ParsecAsyncProgressTimer { public static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode) { long now = System.nanoTime() / DateUtils.MILLIS_PER_SECOND; switch (opCode) { case TIMER_STARTSINGLE: progress.setStartSingleTime(now); break; case TIMER_NAMELOOKUP: progress.setNsLookupTime(now - progress.getStartSingleTime()); break; case TIMER_CONNECT: progress.setConnectTime(now - progress.getStartSingleTime()); break; case TIMER_STARTTRANSFER: progress.setStartTransferTime(now - progress.getStartSingleTime()); break; case TIMER_PRETRANSFER: progress.setPreTransferTime(now - progress.getStartSingleTime()); break; case TIMER_TOTAL: progress.setTotalTime(now - progress.getStartSingleTime()); break; default: LOGGER.warn("opcode=" + opCode + " is not defined"); break; } } }
ParsecAsyncProgressTimer { public static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode) { long now = System.nanoTime() / DateUtils.MILLIS_PER_SECOND; switch (opCode) { case TIMER_STARTSINGLE: progress.setStartSingleTime(now); break; case TIMER_NAMELOOKUP: progress.setNsLookupTime(now - progress.getStartSingleTime()); break; case TIMER_CONNECT: progress.setConnectTime(now - progress.getStartSingleTime()); break; case TIMER_STARTTRANSFER: progress.setStartTransferTime(now - progress.getStartSingleTime()); break; case TIMER_PRETRANSFER: progress.setPreTransferTime(now - progress.getStartSingleTime()); break; case TIMER_TOTAL: progress.setTotalTime(now - progress.getStartSingleTime()); break; default: LOGGER.warn("opcode=" + opCode + " is not defined"); break; } } private  ParsecAsyncProgressTimer(); }
ParsecAsyncProgressTimer { public static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode) { long now = System.nanoTime() / DateUtils.MILLIS_PER_SECOND; switch (opCode) { case TIMER_STARTSINGLE: progress.setStartSingleTime(now); break; case TIMER_NAMELOOKUP: progress.setNsLookupTime(now - progress.getStartSingleTime()); break; case TIMER_CONNECT: progress.setConnectTime(now - progress.getStartSingleTime()); break; case TIMER_STARTTRANSFER: progress.setStartTransferTime(now - progress.getStartSingleTime()); break; case TIMER_PRETRANSFER: progress.setPreTransferTime(now - progress.getStartSingleTime()); break; case TIMER_TOTAL: progress.setTotalTime(now - progress.getStartSingleTime()); break; default: LOGGER.warn("opcode=" + opCode + " is not defined"); break; } } private  ParsecAsyncProgressTimer(); static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode); }
ParsecAsyncProgressTimer { public static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode) { long now = System.nanoTime() / DateUtils.MILLIS_PER_SECOND; switch (opCode) { case TIMER_STARTSINGLE: progress.setStartSingleTime(now); break; case TIMER_NAMELOOKUP: progress.setNsLookupTime(now - progress.getStartSingleTime()); break; case TIMER_CONNECT: progress.setConnectTime(now - progress.getStartSingleTime()); break; case TIMER_STARTTRANSFER: progress.setStartTransferTime(now - progress.getStartSingleTime()); break; case TIMER_PRETRANSFER: progress.setPreTransferTime(now - progress.getStartSingleTime()); break; case TIMER_TOTAL: progress.setTotalTime(now - progress.getStartSingleTime()); break; default: LOGGER.warn("opcode=" + opCode + " is not defined"); break; } } private  ParsecAsyncProgressTimer(); static void progressTime(ParsecAsyncProgress progress, TimerOpCode opCode);  }