1
10import java.io.*;
11
12public class PerfTest {
13 public static int count = 1000000;
14 public static String PROP = "user.dir";
15
16 public static String getsysprop(String prop){
17 return System.getProperty(prop);
18 }
19 public static void main(String[] args) throws IOException {
20 if (args.length > 0){
21 count = Integer.parseInt(args[0]);
22 }
23 System.out.println(PROP + " = " + getsysprop(PROP));
24 String pv = null;
25 for (int r = 0; r < 4; r++){ long ts = System.currentTimeMillis();
27 for (int l = 0; l < count; l++){
28 pv = getsysprop(PROP);
29 }
30 long te = System.currentTimeMillis();
31 System.out.println("Round[" + r + "], Elapsed time for " + count + " iterations: " +
32 (te - ts) + " milli secs.");
33 }
34 }
35}