List of usage examples for java.lang System currentTimeMillis
@HotSpotIntrinsicCandidate public static native long currentTimeMillis();
From source file:ie.peternagy.jcrypto.cli.JCryptoCli.java
public static void main(String[] args) { long startTime = System.currentTimeMillis(); try {/* www . j av a 2s . c o m*/ CommandLineParser parser = new DefaultParser(); CommandLine line = parser.parse(OPTIONS, args); isVerbose = line.hasOption('v'); routeParams(line); if (isVerbose) { System.out.printf("\n Process finished in %dms\n\n", System.currentTimeMillis() - startTime); } } catch (org.apache.commons.cli.ParseException ex) { printCliHelp(); //@todo: override the logger if not in debug mode Logger.getLogger(JCryptoCli.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:validation.ValidationConsumer.java
public static void main(String[] args) throws Exception { String config = ValidationConsumer.class.getPackage().getName().replace('.', '/') + "/validation-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();//w w w.j a v a2 s. co m ValidationService validationService = (ValidationService) context.getBean("validationService"); // ValidationService validationService=new ValidationServiceImpl(); // Save OK ValidationParameter parameter = new ValidationParameter(); parameter.setName("liangfei"); parameter.setEmail("liangfei@liang.fei"); parameter.setAge(1011111); parameter.setLoginDate(new Date(System.currentTimeMillis() + 1000000)); parameter.setExpiryDate(new Date(System.currentTimeMillis() + 1000000)); validationService.save(parameter); System.out.println("Validation Save OK"); // Save Error try { parameter = new ValidationParameter(); validationService.save(parameter); System.err.println("Validation Save ERROR"); } catch (Exception e) { ConstraintViolationException ve = (ConstraintViolationException) e.getCause(); Set<ConstraintViolation<?>> violations = ve.getConstraintViolations(); System.out.println("---save-" + violations); } // Delete OK validationService.delete(2, "abc"); System.out.println("Validation Delete OK"); // Delete Error try { validationService.delete(0, "abc"); System.err.println("Validation Delete ERROR"); } catch (Exception e) { ConstraintViolationException ve = (ConstraintViolationException) e.getCause(); Set<ConstraintViolation<?>> violations = ve.getConstraintViolations(); System.out.println("---save-" + violations); } }
From source file:cloudclient.Client.java
public static void main(String[] args) throws Exception { //Command interpreter CommandLineInterface cmd = new CommandLineInterface(args); String socket = cmd.getOptionValue("s"); String Host_IP = socket.split(":")[0]; int Port = Integer.parseInt(socket.split(":")[1]); String workload = cmd.getOptionValue("w"); try {//from ww w. j ava2 s. com // make connection to server socket Socket client = new Socket(Host_IP, Port); InputStream inStream = client.getInputStream(); OutputStream outStream = client.getOutputStream(); PrintWriter out = new PrintWriter(outStream, true); BufferedReader in = new BufferedReader(new InputStreamReader(inStream)); System.out.println("Send tasks to server..."); //Start clock long startTime = System.currentTimeMillis(); //Batch sending tasks batchSendTask(out, workload); client.shutdownOutput(); //Batch receive responses batchReceiveResp(in); //End clock long endTime = System.currentTimeMillis(); double totalTime = (endTime - startTime) / 1e3; System.out.println("\nDone!"); System.out.println("Time to execution = " + totalTime + " sec."); // close the socket connection client.close(); } catch (IOException ioe) { System.err.println(ioe); } }
From source file:com.linkedin.pinot.perf.BitmapIndexCreationBenchmark.java
public static void main(String[] args) throws Exception { System.out.println("Starting generation"); Configuration tableDataManagerConfig = new PropertiesConfiguration(); List<String> indexColumns = Lists.newArrayList("contract_id", "seat_id"); tableDataManagerConfig.setProperty(IndexLoadingConfigMetadata.KEY_OF_LOADING_INVERTED_INDEX, indexColumns); IndexLoadingConfigMetadata indexLoadingConfigMetadata = new IndexLoadingConfigMetadata( tableDataManagerConfig);//from ww w. j a va 2 s. co m ReadMode mode = ReadMode.heap; File indexDir = new File( "/home/kgopalak/pinot_perf/index_dir/capReportingEvents_OFFLINE/capReportingEvents_capReportingEvents_daily_2"); long start = System.currentTimeMillis(); Loaders.IndexSegment.load(indexDir, mode, indexLoadingConfigMetadata); long end = System.currentTimeMillis(); System.out.println("Took " + (end - start) + " to generate bitmap index"); }
From source file:com.khartec.waltz.jobs.AssetCostHarness.java
public static void main(String[] args) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class); DSLContext dsl = ctx.getBean(DSLContext.class); AssetCostService service = ctx.getBean(AssetCostService.class); AssetCostStatsDao statsDao = ctx.getBean(AssetCostStatsDao.class); AssetCostDao costDao = ctx.getBean(AssetCostDao.class); ApplicationIdSelectorFactory selectorFactory = ctx.getBean(ApplicationIdSelectorFactory.class); long st = System.currentTimeMillis(); System.out.println("-- start"); IdSelectionOptions appIdSelectionOptions = ImmutableIdSelectionOptions.builder() .scope(HierarchyQueryScope.CHILDREN) .entityReference(ImmutableEntityReference.builder().id(5600).kind(EntityKind.CAPABILITY).build()) .build();//from ww w .ja va 2 s . co m List<Tuple2<Long, BigDecimal>> costs = service.calculateCombinedAmountsForSelector(appIdSelectionOptions); System.out.println("-- end, dur: " + (System.currentTimeMillis() - st)); System.out.println(costs); System.out.println(costs.size()); }
From source file:EarlyReturn.java
public static void main(String[] args) { try {//from ww w. j a v a2 s . c om final EarlyReturn er = new EarlyReturn(0); Runnable r = new Runnable() { public void run() { try { Thread.sleep(1500); er.setValue(2); Thread.sleep(500); er.setValue(3); Thread.sleep(500); er.setValue(4); } catch (Exception x) { x.printStackTrace(); } } }; Thread t = new Thread(r); t.start(); System.out.println("waitUntilAtLeast(5, 3000)"); long startTime = System.currentTimeMillis(); boolean retVal = er.waitUntilAtLeast(5, 3000); long elapsedTime = System.currentTimeMillis() - startTime; System.out.println(elapsedTime + " ms, retVal=" + retVal); } catch (InterruptedException ix) { ix.printStackTrace(); } }
From source file:com.alibaba.dubbo.examples.validation.ValidationConsumer.java
public static void main(String[] args) throws Exception { String config = ValidationConsumer.class.getPackage().getName().replace('.', '/') + "/validation-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();/*ww w . j a va 2s . co m*/ ValidationService validationService = (ValidationService) context.getBean("validationService"); // Save OK ValidationParameter parameter = new ValidationParameter(); parameter.setName("liangfei"); parameter.setEmail("liangfei@liang.fei"); parameter.setAge(50); parameter.setLoginDate(new Date(System.currentTimeMillis() - 1000000)); parameter.setExpiryDate(new Date(System.currentTimeMillis() + 1000000)); validationService.save(parameter); System.out.println("Validation Save OK"); // Save Error try { parameter = new ValidationParameter(); validationService.save(parameter); System.err.println("Validation Save ERROR"); } catch (RpcException e) { ConstraintViolationException ve = (ConstraintViolationException) e.getCause(); Set<ConstraintViolation<?>> violations = ve.getConstraintViolations(); System.out.println(violations); } // Delete OK validationService.delete(2, "abc"); System.out.println("Validation Delete OK"); // Delete Error try { validationService.delete(0, "abc"); System.err.println("Validation Delete ERROR"); } catch (RpcException e) { ConstraintViolationException ve = (ConstraintViolationException) e.getCause(); Set<ConstraintViolation<?>> violations = ve.getConstraintViolations(); System.out.println(violations); } }
From source file:org.bigtextml.drivers.BigMapTest.java
public static void main(String[] args) { /*//from www . j av a 2s . com ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"InMemoryDataMining.xml"}); */ System.out.println(System.getProperty("InvokedFromSpring")); //Map<String,List<Integer>> bm = context.getBean("bigMapTest",BigMap.class); Map<String, List<Integer>> bm = ManagementServices.getBigMap("tmCache"); System.out.println(((BigMap) bm).getCacheName()); int max = 1000000; //bm.setMaxCapacity(1000); for (int i = 0; i < max; i++) { List<Integer> x = new ArrayList<Integer>(); for (int j = 0; j < 5; j++) { x.add(j); } x.add(i); bm.put(Integer.toString(i), x); } String key = Integer.toString(max - 1); //bm.remove(key); for (int i = 0; i < 3; i++) { long millis = System.currentTimeMillis(); System.out.println(bm.get(Integer.toString(500000))); System.out.println(System.currentTimeMillis() - millis); } bm.clear(); }
From source file:TableCreateLazy.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new RowLayout(SWT.VERTICAL)); final Table table = new Table(shell, SWT.VIRTUAL | SWT.BORDER); table.addListener(SWT.SetData, new Listener() { public void handleEvent(Event event) { TableItem item = (TableItem) event.item; int index = table.indexOf(item); item.setText("Item " + index); System.out.println(item.getText()); }//from w ww . j ava 2 s .c o m }); table.setLayoutData(new RowData(200, 200)); long t1 = System.currentTimeMillis(); table.setItemCount(COUNT); long t2 = System.currentTimeMillis(); System.out.println("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms)"); shell.layout(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:com.genentech.chemistry.tool.SDF2HtmlTab.java
public static void main(String[] args) throws ParseException, JDOMException, IOException { long start = System.currentTimeMillis(); // create command line Options object Options options = new Options(); Option opt = new Option("in", true, "input sd file"); opt.setRequired(true);//w ww .j a va 2 s . com options.addOption(opt); CommandLineParser parser = new BasicParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (Exception e) { System.err.println(e.getMessage()); exitWithHelp(options); } args = cmd.getArgs(); String inFile = cmd.getOptionValue("in"); args = cmd.getArgs(); if (args.length > 0) { exitWithHelp(options); } oemolistream ifs; Set<String> tagSet = getTagSet(inFile); System.out.println( "<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'>"); System.out.println("<head>"); System.out.println("<BASE href='" + BASEUrl + "'/>"); System.out.println( "<link href='/" + Settings.SERVLET_CONTEXT + "/css/Aestel.css' rel='stylesheet' type='text/css'/>"); System.out.println("<style type='text/css'>"); System.out.println("td.stru { width: " + (IMGWidth + 2) + "px; height: " + (IMGHeigth + 4) + "px; vertical-align: top; }"); System.out.println("table.grid tr.first { border-top: 3px solid black; }"); // for tables in tables System.out.println("table.grid table td { border: 0px; text-align: right;}"); System.out.println("table.grid table td:first-child { text-align: left;}"); System.out.println("th.head { border-left: 1px solid black; border-bottom: 2px solid black;\n" + " empty-cells: show; background-color: #6297ff; color: #000000;\n" + " padding: 0em .3em 0em .3em; vertical-align: middle; }"); System.out.println("</style>"); System.out.println("</head>"); System.out.println("<body>"); System.out.println("<table class='grid'><tr>"); System.out.println("<th class='head'>Structure</th>"); for (String tag : tagSet) System.out.println("<th class='head'>" + tag + "</th>"); System.out.println("</tr>"); OEGraphMol mol = new OEGraphMol(); ifs = new oemolistream(inFile); int iCounter = 0; while (oechem.OEReadMolecule(ifs, mol)) { iCounter++; System.out.println("<tr>"); String smi = OETools.molToCanSmi(mol, true); String img = DepictHelper.DEFAULT.getExcelSmilesImageElement(BASEUrl, 120, 120, ImageType.PNG, smi, null); System.out.print(" <td class='stru'>"); System.out.print(img); System.out.println("</td>"); for (String tag : tagSet) { String val = oechem.OEGetSDData(mol, tag); System.out.print(" <td>"); System.out.print(val); System.out.println("</td>"); } System.out.println("</tr>"); } System.out.println("</table></body></html>"); System.err.printf("SDF2HtmlTab: Exported %d structures in %dsec\n", iCounter, (System.currentTimeMillis() - start) / 1000); }