Package de.christofreichardt.diagnosis
Class TraceMethod
java.lang.Object
de.christofreichardt.diagnosis.TraceMethod
Outlines a method for tracing.
- Author:
- Christof Reichardt
-
Constructor Summary
ConstructorsConstructorDescriptionTraceMethod(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
Modifier and TypeMethodDescriptionClass<?>getClazz()The class owning the method.longThis is the elapsed CPU time since the construction of the TraceMethod until the moment the TraceMethod is popped from the stack again.longThis is the elapsed time in milliseconds since the construction of the TraceMethod until the moment the TraceMethod is popped from the stack again.The method name inclusive list of parameters.This is the string representation of the method signature.voidstopTime()Stops the elapsed (cpu) time since creation of this TraceMethod instance.
-
Constructor Details
-
TraceMethod
Constructs a TraceMethod with the specified signature.- Parameters:
signature- the signature of the TraceMethod
-
TraceMethod
Deprecated.Constructs a TraceMethod with the specified signature and class.- Parameters:
signature- the signature of the TraceMethodclazz- the class of the TraceMethod
-
TraceMethod
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
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 Details
-
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
The class owning the method.- Returns:
- the clazz
-
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.
-