List of usage examples for java.lang System nanoTime
@HotSpotIntrinsicCandidate public static native long nanoTime();
From source file:apiserver.services.pdf.service.DeletePdfPagesCFService.java
public Object execute(Message<?> message) throws ColdFusionException { DeletePdfPagesResult props = (DeletePdfPagesResult) message.getPayload(); try {// w w w . j av a2 s.c o m long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new DeletePagesCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.RemotePdfWatermarkCFService.java
public Object execute(Message<?> message) throws ColdFusionException { WatermarkPdfResult props = (WatermarkPdfResult) message.getPayload(); try {/*w w w.j a v a 2 s . c o m*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new RemoveWatermarkCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:com.github.jinahya.codec.BossVsEngineerTestNanoTimeDecode.java
private static long decodeLikeAnEngineer(final byte[] encoded) { final long start = System.nanoTime(); new HexDecoder().decodeLikeAnEngineer(encoded); return System.nanoTime() - start; }
From source file:com.github.jinahya.codec.BossVsEngineerTestNanoTimeEncode.java
private static long encodeLikeAnEngineer(final byte[] decoded) { final long start = System.nanoTime(); new HexEncoder().encodeLikeAnEngineer(decoded); return System.nanoTime() - start; }
From source file:apiserver.services.pdf.service.ExtractPdfFormFieldsCFService.java
public Object execute(Message<?> message) throws ColdFusionException { ExtractPdfFormResult props = (ExtractPdfFormResult) message.getPayload(); try {/*from w w w . j a v a2 s .c o m*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<MapResult> future = exec.submit(new ExtractFormFieldsCallable(props.getFile().getFileBytes())); MapResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getData()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:de.forsthaus.backend.util.db.logging.ServiceLogging.java
public Object logging(ProceedingJoinPoint call) throws Throwable { startTimes.add(Long.valueOf(System.nanoTime())); try {//from w ww .j a va2 s.c o m // LOG.info("Start call: " + call.toShortString()); return call.proceed(); } finally { methodName = call.toShortString(); finishTime = (System.nanoTime() - startTimes.remove().longValue()) / 1000000; if (startTimes.isEmpty()) { methodName = StringUtils.substring(methodName, 10, -1); // LOG.info("Execution time: " + finishTime + "ms " + // methodName); loggingService.saveStatistics(statistics, methodName, finishTime); init(); } } }
From source file:apiserver.services.pdf.service.RemovePdfHeaderFooterCFService.java
public Object execute(Message<?> message) throws ColdFusionException { OptimizePdfResult props = (OptimizePdfResult) message.getPayload(); try {//from ww w. j a v a 2 s . c om long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new RemoveHeaderFooterCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.PopulatePdfFormFieldsCFService.java
public Object execute(Message<?> message) throws ColdFusionException { PopulatePdfFormResult props = (PopulatePdfFormResult) message.getPayload(); try {//from w w w .ja v a2 s .c o m long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new PopulateFormFieldsCallable(props.getFile().getFileBytes(), props.getFields(), ((String) props.getOptions().get("password")))); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:org.eclipse.json.http.HttpHelper.java
public static long getElapsedTimeInMs(long startTime) { return ((System.nanoTime() - startTime) / 1000000L); }
From source file:de.elatexam.UploadTaskdefServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { UserService userService = UserServiceFactory.getUserService(); if (!userService.isUserLoggedIn()) { resp.sendRedirect("/"); } else {/*from w w w . jav a 2 s .co m*/ try { ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iterator = upload.getItemIterator(req); while (iterator.hasNext()) { FileItemStream item = iterator.next(); long handle = System.nanoTime(); DataStoreTaskFactory.getInstance().storeTaskDef(item.openStream(), handle, userService.getCurrentUser()); } } catch (Exception ex) { throw new ServletException(ex); } resp.sendRedirect("/"); } }