Package de.christofreichardt.diagnosis
Class TraceMethod
- java.lang.Object
-
- de.christofreichardt.diagnosis.TraceMethod
-
public class TraceMethod extends Object
Outlines a method for tracing.- Author:
- Christof Reichardt
-
-
Constructor Summary
Constructors Constructor Description TraceMethod(String signature)Constructs a TraceMethod with the specified signature.TraceMethod(String signature, Class<?> clazz)Deprecated.TraceMethod(String returnType, Class<?> clazz, String methodSignature)Constructs a TraceMethod with the specified signature.TraceMethod(String returnType, Object object, String methodSignature)Constructs a TraceMethod with the specified signature.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getClazz()The class owning the method.longgetElapsedCpuTime()This is the elapsed CPU time since the construction of the TraceMethod until the moment the TraceMethod is popped from the stack again.longgetElapsedTime()This is the elapsed time in milliseconds since the construction of the TraceMethod until the moment the TraceMethod is popped from the stack again.StringgetMethodName()The method name inclusive list of parameters.StringgetSignature()This is the string representation of the method signature.voidstopTime()Stops the elapsed (cpu) time since creation of this TraceMethod instance.
-
-
-
Constructor Detail
-
TraceMethod
public TraceMethod(String signature)
Constructs a TraceMethod with the specified signature.- Parameters:
signature- the signature of the TraceMethod
-
TraceMethod
@Deprecated public TraceMethod(String signature, Class<?> clazz)
Deprecated.Constructs a TraceMethod with the specified signature and class.- Parameters:
signature- the signature of the TraceMethodclazz- the class of the TraceMethod
-
TraceMethod
public TraceMethod(String returnType, Object object, String methodSignature)
Constructs a TraceMethod with the specified signature.- Parameters:
returnType- the return type of the method as string representationobject- the object that owns the methodmethodSignature- the remaining method signature (without return type) inclusive parameter as string representation
-
TraceMethod
public TraceMethod(String returnType, Class<?> clazz, String methodSignature)
Constructs a TraceMethod with the specified signature.- Parameters:
returnType- the return type of the method as string representationclazz- the class to which that method belongmethodSignature- the remaining method signature (without return type) inclusive parameter as string representation
-
-
Method Detail
-
getSignature
public String getSignature()
This is the string representation of the method signature. It is composed of the return type, the owning class and the remaining method signature (method name and list of parameters).- Returns:
- the signature
-
getElapsedTime
public long getElapsedTime()
This is the elapsed time in milliseconds since the construction of the TraceMethod until the moment the TraceMethod is popped from the stack again.- Returns:
- the elapsedTime
-
getElapsedCpuTime
public long getElapsedCpuTime()
This is the elapsed CPU time since the construction of the TraceMethod until the moment the TraceMethod is popped from the stack again. That is only the execution time of the current thread on the CPU will be measured. Suppose the scheduler decides to switch the contect to another thread during the execution of the method. This time doesn't count. Or the method itself passes the actual work to another thread. That doesn't count either.- Returns:
- the elapsedCpuTime
-
getClazz
public Class<?> getClazz()
The class owning the method.- Returns:
- the clazz
-
getMethodName
public String getMethodName()
The method name inclusive list of parameters.- Returns:
- the methodName
-
stopTime
public void stopTime()
Stops the elapsed (cpu) time since creation of this TraceMethod instance.
-
-