Example usage for java.lang System currentTimeMillis

List of usage examples for java.lang System currentTimeMillis

Introduction

In this page you can find the example usage for java.lang System currentTimeMillis.

Prototype

@HotSpotIntrinsicCandidate
public static native long currentTimeMillis();

Source Link

Document

Returns the current time in milliseconds.

Usage

From source file:com.ciphertool.zodiacengine.genetic.GeneticCipherSolutionEngine.java

/**
 * @param args//from w w w . j  a v a 2s. co m
 * @throws InterruptedException
 */
public static void main(String[] args) throws InterruptedException {
    // Spin up the Spring application context
    setUp();

    long start = System.currentTimeMillis();

    geneticAlgorithm.evolveAutonomously();

    /*
     * Print out summary information
     */
    log.info("Took " + (System.currentTimeMillis() - start) + "ms to finish.");

    geneticAlgorithm.getPopulation().printAscending();

    tearDown();
}

From source file:com.puffywhiteshare.PWSApp.java

/**
 * @param args/*from w  w w.  ja v a2s . co  m*/
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    CloudBucket cloud = new CloudBucket();
    logger.info("Test my output bitches");
    Yaml y = new Yaml();
    File f = new File("Playing.yml");
    FileInputStream fis = new FileInputStream(f);
    Map m = (Map) y.load(fis);

    Long startFiles = System.currentTimeMillis();
    Iterator<File> fileIterator = FileUtils.iterateFiles(new File("/Users/chad/Pictures/."), null, true);
    do {
        File file = fileIterator.next();
        cloud.add(file);
    } while (fileIterator.hasNext());
    Long endFiles = System.currentTimeMillis();
    System.out.println("Files processing took " + ((endFiles - startFiles)));

    Long startSer = System.currentTimeMillis();
    String filename = "cloud.ser";
    FileOutputStream fos = null;
    ObjectOutputStream out = null;
    try {
        fos = new FileOutputStream(filename);
        out = new ObjectOutputStream(fos);
        out.writeObject(cloud);
        out.close();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    Long endSer = System.currentTimeMillis();
    System.out.println("Files processing took " + ((endSer - startSer)));

    logger.info(" Size = " + FileUtils.byteCountToDisplaySize(cloud.getSize()));
    logger.info("Count = " + cloud.getCount());

    /*
    Set<String> buckets = m.keySet();
    System.out.println(m.toString());
    for(String bucket : buckets) {
       logger.info("Bucket = " + bucket);
       logger.info("Folders = " + m.get(bucket));
       List<Object> folders = (List<Object>) m.get(bucket);
       for(Object folder : folders) {
    if(folder instanceof String) {
       logger.info("Folder Root = " + folder);
    } else if(folder instanceof Map) {
       logger.info("Folder Map = " + folder);
    }
       }
       BlockingQueue<File> fileFeed = new ArrayBlockingQueue<File>(10);
               
       Map folderMap = (Map) m.get(bucket);
       Set<String> folders = folderMap.entrySet();
       for(String folder : folders) {
    logger.info("Folder = " + folder);
       }
               
    }
    */
}

From source file:org.vuphone.vandyupon.test.EventRatingRequestTest.java

public static void main(String[] args) {
    HttpClient c = new DefaultHttpClient();
    HttpPost post = new HttpPost("http://localhost:8080/vandyupon/events/");
    post.addHeader("Content-Type", "application/x-www-form-urlencoded");

    String params = "type=eventpost&eventname=Test&starttime=" + System.currentTimeMillis() + "&endtime="
            + (System.currentTimeMillis() + 6000000)
            + "&userid=chris&resp=xml&desc=a%20new%20event&locationlat=36.1437&locationlon=-86.8046";
    post.setEntity(new ByteArrayEntity(params.toString().getBytes()));

    try {//from  ww  w.j  av  a2s  . co m
        HttpResponse resp = c.execute(post);
        resp.getEntity().writeTo(System.out);
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:org.eclipse.swt.snippets.Snippet144.java

public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("Snippet 144");
    shell.setLayout(new RowLayout(SWT.VERTICAL));
    final Table table = new Table(shell, SWT.VIRTUAL | SWT.BORDER);
    table.addListener(SWT.SetData, event -> {
        TableItem item = (TableItem) event.item;
        int index = table.indexOf(item);
        item.setText("Item " + index);
        System.out.println(item.getText());
    });// w  w  w  .  ja v  a2 s . c o  m
    table.setLayoutData(new RowData(200, 200));
    Button button = new Button(shell, SWT.PUSH);
    button.setText("Add Items");
    final Label label = new Label(shell, SWT.NONE);
    button.addListener(SWT.Selection, event -> {
        long t1 = System.currentTimeMillis();
        table.setItemCount(COUNT);
        long t2 = System.currentTimeMillis();
        label.setText("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.renatodelgaudio.awsupdate.RouteMain.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
    Updater updater = context.getBean(Updater.class);

    log.info("Running " + updater.getClass().getName() + " ....");
    long start = System.currentTimeMillis();
    try {//from  w ww  . j av a2 s  . c o  m
        updater.run(context);
    } catch (Exception e) {
        log.error("Opps something went wrong", e);
    }
    long end = System.currentTimeMillis();
    long timeMin = (end - start) / 1000 / 60 / 60;
    log.info(updater.getClass().getName() + " completed in " + timeMin + " sec.");
}

From source file:org.eel.kitchen.jsonschema.MiniPerfTest2.java

public static void main(final String... args) throws IOException, JsonSchemaException {
    final JsonNode googleAPI = JsonLoader.fromResource("/other/google-json-api.json");
    final Map<String, JsonNode> schemas = JacksonUtils.nodeToMap(googleAPI.get("schemas"));

    final JsonSchemaFactory factory = JsonSchemaFactory.defaultFactory();
    final JsonSchema schema = factory.fromURI("resource:/schema-draftv3.json");

    long begin, current;
    begin = System.currentTimeMillis();
    doValidate(schemas, schema, -1);/*from  w  w w . j  a  va2  s . co  m*/
    current = System.currentTimeMillis();

    System.out.println("Initial validation :" + (current - begin) + " ms");

    begin = System.currentTimeMillis();
    for (int i = 0; i < 500; i++) {
        doValidate(schemas, schema, i);
        if (i % 20 == 0) {
            current = System.currentTimeMillis();
            System.out.println(String.format("Iteration %d (in %d ms)", i, current - begin));
        }
    }

    final long end = System.currentTimeMillis();
    System.out.println("END -- time in ms: " + (end - begin));
    System.exit(0);
}

From source file:ca.roussil.ec2instancestarter.StarterMain.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
    Starter starter = context.getBean(Starter.class);

    log.info("Running " + starter.getClass().getName() + " ....");
    long start = System.currentTimeMillis();
    try {//from  w w  w  . ja  v a 2 s .  c om
        starter.run(context);
    } catch (Exception e) {
        log.error("Opps something went wrong", e);
    }
    long end = System.currentTimeMillis();
    long timeMin = (end - start) / 1000 / 60 / 60;
    log.info(starter.getClass().getName() + " completed in " + timeMin + " sec.");
}

From source file:com.moscona.dataSpace.debug.BadLocks.java

public static void main(String[] args) {
    try {//from w  ww . j  av  a2  s  .c  om
        String lockFile = "C:\\Users\\Admin\\projects\\intellitrade\\tmp\\bad.lock";
        FileUtils.touch(new File(lockFile));
        FileOutputStream stream = new FileOutputStream(lockFile);
        //            FileInputStream stream = new FileInputStream(lockFile);
        FileChannel channel = stream.getChannel();
        //            FileLock lock = channel.lock(0,Long.MAX_VALUE, true);
        FileLock lock = channel.lock();
        stream.write(new UndocumentedJava().pid().getBytes());
        stream.flush();
        long start = System.currentTimeMillis();
        //            while (System.currentTimeMillis()-start < 10000) {
        //                Thread.sleep(500);
        //            }
        lock.release();
        stream.close();
        File f = new File(lockFile);
        System.out.println("Before write: " + FileUtils.readFileToString(f));
        FileUtils.writeStringToFile(f, "written after lock released");
        System.out.println("After write: " + FileUtils.readFileToString(f));
    } catch (Exception e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }

}

From source file:com.khartec.waltz.jobs.AuthSourceHarness.java

public static void main(String[] args) {

    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    AuthoritativeSourceCalculator authoritativeSourceCalculator = ctx
            .getBean(AuthoritativeSourceCalculator.class);

    long CTO_OFFICE = 40;
    long CTO_ADMIN = 400;
    long CEO_OFFICE = 10;
    long CIO_OFFICE = 20;
    long MARKET_RISK = 220;
    long CREDIT_RISK = 230;
    long OPERATIONS_IT = 200;
    long RISK = 210;

    long orgUnitId = CIO_OFFICE;

    authoritativeSourceCalculator.calculateAuthSourcesForOrgUnitTree(orgUnitId);

    long st = System.currentTimeMillis();
    for (int i = 0; i < 100; i++) {
        authoritativeSourceCalculator.calculateAuthSourcesForOrgUnitTree(orgUnitId);
    }/*from  ww  w.j  av a 2s  . c om*/
    long end = System.currentTimeMillis();

    System.out.println("DUR " + (end - st));
    Map<Long, Map<String, Map<Long, AuthoritativeSource>>> rulesByOrgId = authoritativeSourceCalculator
            .calculateAuthSourcesForOrgUnitTree(orgUnitId);

    System.out.println("--CIO---");
    AuthoritativeSourceCalculator.prettyPrint(rulesByOrgId.get(CIO_OFFICE));

    System.out.println("--RISK---");
    AuthoritativeSourceCalculator.prettyPrint(rulesByOrgId.get(RISK));

    System.out.println("--MARKETRISK---");
    AuthoritativeSourceCalculator.prettyPrint(rulesByOrgId.get(MARKET_RISK));

    System.out.println("--OPS---");
    AuthoritativeSourceCalculator.prettyPrint(rulesByOrgId.get(OPERATIONS_IT));

    System.out.println("--CREDIT RISK---");
    AuthoritativeSourceCalculator.prettyPrint(rulesByOrgId.get(CREDIT_RISK));

}

From source file:com.github.fge.jsonschema.NewAPIPerfTest.java

public static void main(final String... args) throws IOException, ProcessingException {
    final JsonNode googleAPI = JsonLoader.fromResource("/other/google-json-api.json");
    final Map<String, JsonNode> googleSchemas = JacksonUtils.asMap(googleAPI.get("schemas"));

    long begin, current;
    begin = System.currentTimeMillis();
    doValidate(googleSchemas, -1);//from   w  ww  .j a  v a 2  s.  c om
    current = System.currentTimeMillis();

    System.out.println("Initial validation :" + (current - begin) + " ms");

    begin = System.currentTimeMillis();
    for (int i = 0; i < 500; i++) {
        doValidate(googleSchemas, i);
        if (i % 20 == 0) {
            current = System.currentTimeMillis();
            System.out.println(String.format("Iteration %d (in %d ms)", i, current - begin));
        }
    }

    final long end = System.currentTimeMillis();
    System.out.println("END -- time in ms: " + (end - begin));
    System.exit(0);
}