From 74a515589df94a3378da48f275bd08f7595bca19 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 22 Jan 2008 16:17:03 +0000 Subject: [PATCH] timings and memory usage for reading in a file --- src/jalview/io/AppletFormatAdapter.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index a91a1b0..d9b0b55 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -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); -- 1.7.10.2