timings and memory usage for reading in a file
[jalview.git] / src / jalview / io / AppletFormatAdapter.java
index a91a1b0..d9b0b55 100755 (executable)
@@ -309,7 +309,17 @@ public class AppletFormatAdapter
       {
         try {
           AppletFormatAdapter afa = new AppletFormatAdapter();
-          afa.readFile(args[i], FILE, new IdentifyFile().Identify(args[i], FILE));
+          Runtime r = Runtime.getRuntime();
+          System.gc();
+          long memf = -r.totalMemory()+r.freeMemory();
+          long t1 = -System.currentTimeMillis();
+          Alignment al = afa.readFile(args[i], FILE, new IdentifyFile().Identify(args[i], FILE));
+          t1 +=System.currentTimeMillis();
+          System.gc();
+          memf += r.totalMemory()-r.freeMemory();
+          System.out.println("Read took "+(t1/1000.0)+" seconds.");
+          System.out.println("Difference between free memory now and before is "+(memf/(1024.0*1024.0)*1.0)+" MB");
+          
         } catch (Exception e)
         {
           System.err.println("Exception when dealing with "+i+"'th argument: "+args[i]+"\n"+e);