/* On marian, the first timed operation - creating an array of 100000 file names - takes about 300 ms. The second (real) timing test, creating the corresponding files, took about 40 seconds for an inefficient version and about 900 ms for a more efficient one. */ import java.util.*; public class TimingTest { public static void main(String[] args) throws Exception { int n = 100000; // size of the system System.out.println("Creating a new file system of size " + n); FileSystem fs = new FileSystem(n); long after, before, time; before = System.currentTimeMillis(); String[][] files = new String[n][]; for (int i = 0; i < n; i++){ String[] fn = new String[2]; fn[0] = "root"; fn[1] = "file"+i; files[i] = fn; } after = System.currentTimeMillis(); time = after - before; System.out.print("Time taken to create array of file names: "); System.out.print(time); System.out.println(" milliseconds"); System.out.println("Creating the files"); before = System.currentTimeMillis(); for (int i = 0; i < n; i++){ fs.file(files[i],1); } after = System.currentTimeMillis(); time = after - before; System.out.print("Time taken to create the files: "); System.out.print(time); System.out.println(" milliseconds"); } }