X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Futil%2FPlatform.java;h=0b9185c05d685b55bfb6b527cae193173fcecca8;hb=52835208007a37595aa07b40981a8609bad957e0;hp=0d7724b399c78bea9cd42d0f98f616d87639ac94;hpb=3c649fa5f3632a9e7a47a533ce0c11cc67622788;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 0d7724b..0b9185c 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -198,4 +198,43 @@ public class Platform { return !isMac(); } + + public final static int TIME_RESET = 0; + public final static int TIME_MARK = 1; + public static final int TIME_SET = 2; + public static final int TIME_GET = 3; + + public static long time, mark, set, duration; + + public static void timeCheck(String msg, int mode) { + long t = System.currentTimeMillis(); + switch (mode) { + case TIME_RESET: + time = mark = t; + if (msg != null) + System.err.println("Platform: timer reset\t\t\t" + msg); + break; + case TIME_MARK: + if (set > 0) { + duration += (t - set); + } else { + if (time == 0) + time = mark = t; + if (msg != null) + System.err.println("Platform: timer mark\t" + ((t - time)/1000f) + "\t" + ((t - mark)/1000f) + "\t" + msg); + mark = t; + } + break; + case TIME_SET: + set = t; + break; + case TIME_GET: + if (msg != null) + System.err.println("Platform: timer dur\t" + ((t - time)/1000f) + "\t" + ((duration)/1000f) + "\t" + msg); + set = 0; + break; + } + } + + }