hi can anyone help me in this issue
I am invoking a method "add" of class "CustomeMath" now i want to know the the execution time taken by the method addMe() only (This time does not include the execution time taken by method "Invoke()" of reflection to invoke some method.).I am posting the generic code of this problem.
import java.lang.reflect.*;
public class CustomeMath{ public int addMe(int a, int b) { return a + b; }
public static void main(String args[]) { try { Class cls = Class.forName("CustomeMath"); Class partypes[] = new Class[2]; partypes[0] = Integer.TYPE; partypes[1] = Integer.TYPE; Method meth = cls.getMethod( "addMe", partypes); CustomeMath methobj = new CustomeMath(); Object arglist[] = new Object[2]; arglist[0] = new Integer(37); arglist[1] = new Integer(47); Object retobj = meth.invoke(methobj, arglist); Integer retval = (Integer)retobj; System.out.println(retval.intValue()); } catch (Throwable e) { System.err.println(e); } }
}
Now i want to get the execution time taken by the method "addMe()".and this time doesn't include time taken by the "invoke()" method.How do i get this time?(Remember i dont want to use the "System.currentTimeMillis();")