示例#1
0
 public static long getItemCountPerSecond(String name, long elements) {
   NanoTimerElement timer = users.get(name);
   timer.refresh();
   if (timer == null) return -1;
   if (elements < 0) return -1;
   if (timer.getElapsedTime() == 0) return -1;
   long items = (BILLION * elements) / timer.getElapsedTime();
   return items;
 }
示例#2
0
 public static String getElapsedTimeStringAsMillis(String name) {
   NanoTimerElement timer = users.get(name);
   if (timer == null) return "Invalid chronometer: " + name;
   ;
   timer.refresh();
   return "Delta: "
       + timer.getDiff() / MILLION
       + "ms. Elapsed: "
       + timer.getElapsedTime() / MILLION
       + " ms.";
 }
示例#3
0
 public static String getElapsedTimeString(String name) {
   NanoTimerElement timer = users.get(name);
   if (timer == null) return "Invalid chronometer: " + name;
   ;
   timer.refresh();
   return "Delta: "
       + formatter.format((double) timer.getDiff() / BILLION)
       + " s. Elapsed: "
       + formatter.format((double) timer.getElapsedTime() / BILLION)
       + " s.";
 }
示例#4
0
 public static String stopClock(String name) {
   NanoTimerElement timer = users.get(name);
   if (timer == null) return name + " : Invalid chronometer";
   timer.refresh();
   users.remove(name);
   return ""
       + (double) timer.elapsedTime / BILLION
       + "s."
       + "("
       + timer.elapsedTime / MILLION
       + " ms)";
 }
示例#5
0
 public static long getTimeDeltaMillis(String name) {
   NanoTimerElement timer = users.get(name);
   if (timer == null) return -1;
   timer.refresh();
   return timer.getDiff() / MILLION;
 }
示例#6
0
 public static long getElapsedTimeMillis(String name) {
   NanoTimerElement timer = users.get(name);
   if (timer == null) return -1;
   timer.refresh();
   return timer.getElapsedTime();
 }