@@ -0,0 +1,3092 @@
+/*%0A * Copyright (c) 2013-2013, KNOPFLERFISH project%0A * All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following%0A * conditions are met:%0A *%0A * - Redistributions of source code must retain the above copyright%0A *   notice, this list of conditions and the following disclaimer.%0A *%0A * - Redistributions in binary form must reproduce the above%0A *   copyright notice, this list of conditions and the following%0A *   disclaimer in the documentation and/or other materials%0A *   provided with the distribution.%0A *%0A * - Neither the name of the KNOPFLERFISH project nor the names of its%0A *   contributors may be used to endorse or promote products derived%0A *   from this software without specific prior written permission.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS%0A * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE%0A * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,%0A * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES%0A * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR%0A * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)%0A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,%0A * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)%0A * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED%0A * OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage org.knopflerfish.util;%0A%0Aimport java.lang.reflect.InvocationTargetException;%0Aimport java.lang.reflect.Method;%0Aimport java.security.AccessController;%0Aimport java.security.PrivilegedAction;%0A%0A%0A/**%0A * Misc static timer utility methods.%0A */%0Apublic class Timer %7B%0A%0A  static private Method nanoTimeMethod;%0A%0A  static %7B%0A    AccessController.doPrivileged(new PrivilegedAction() %7B%0A      public Object run() %7B%0A        nanoTimeMethod = getMethod(System.class, %22nanoTime%22, new Class%5B%5D %7B %7D);%0A        return null;%0A      %7D%0A    %7D);%0A  %7D%0A%0A  /**%0A   * Get method from class%0A   */%0A  public static Method getMethod(Class c, String name, Class %5B%5D args) %7B%0A    Method m = null;%0A    while (true) %7B%0A      try %7B%0A        m = c.getDeclaredMethod(name, args);%0A        break;%0A      %7D catch (NoSuchMethodException e) %7B%0A        c = c.getSuperclass();%0A        if (c == null) %7B%0A          return null;%0A        %7D%0A      %7D%0A    %7D%0A    return m;%0A  %7D%0A%0A  /**%0A   * Use System.nanoTime() if available, otherwise revert to%0A   * System.currentTimeMillis(). Return time in milliseconds%0A   * that can be used for time measurements.%0A   */%0A  public static long timeMillis() %7B%0A    if (nanoTimeMethod != null) %7B%0A      try  %7B%0A        Object res = nanoTimeMethod.invoke(null, new Object%5B%5D %7B %7D);%0A        if (res != null) %7B%0A          return ((Long)res).longValue() / 1000000L;%0A        %7D%0A      %7D catch (IllegalAccessException _ignore) %7B %0A      %7D catch (InvocationTargetException _ignore) %7B %7D%0A    %7D%0A    return System.currentTimeMillis();%0A  %7D%0A%0A%7D%0A

Add file missed in last check-in.