Hi can anyone help me in this issue
>I am executing a method of a Java class using Java Reflection.Now i want to get the real execution time of a method regardless the time taken by reflection.
class AClass { //method
void abc(){ System.out.println("Hello World"); }
//Now using reflection i am going to invoke this method
AClass aObj=new AClass();
Class _cObj=Class.forName("AClass"); Method _meth_Invoke=cObj.getMethod("abc",null);
//Now hear as u see that if i take time Stamp before executing this (Method.invoke())statement and then after take another time stamp and subtract it(using "System.nanoTime()" ), then i get the TIME of both methods abc()+ invoke() method.And thats the problem that i just want to get know the actual execution time of Method abc().
_meth_Invoke.invoke(aObj,...); }
Kindly guide me i spent a lot of time on surfing but cant fine the right material for it.
new Date()
, call the method, create anothernew Date()
and find the time difference – smartcaveman