1 17 18 package org.objectweb.jac.samples.photos; 19 20 import org.objectweb.jac.lib.Attachment; 21 import java.util.Iterator ; 22 23 public class Bench { 24 25 30 31 public static void main(String [] args) throws Exception 32 { 33 35 50 } 51 52 static public void createPhotos(int n) throws Throwable { 53 System.out.println("Creating photos "+n+"..."); 54 59 long _start_time = System.currentTimeMillis(); 60 for (int i=0; i<n; i++) { 61 System.out.print("."); 62 Photo photo = 63 new Photo("Test"+i, 64 new Attachment("Hello".getBytes(),"text/plain","hello")); 65 photo.setAuthor(new Person()); 67 } 68 System.out.println("object instanciations runned in "+ 69 (System.currentTimeMillis()-_start_time)+"ms"); 70 75 _start_time = System.currentTimeMillis(); 76 } 77 78 static void printUsage() { 79 System.out.println("Usage: jac bench.jac <nbPhotos>"); 80 System.out.println(" <nbPhotos>: number of photos to create"); 81 } 82 } 83 84 | Popular Tags |