public class Recorder extends RecorderFrontend implements de.uni_hildesheim.sse.system.IMemoryUnallocationReceiver
| Modifier and Type | Field and Description |
|---|---|
static boolean |
CALIBRATE_RECORDER
Stores if the recorder (i.e. the static sizes) should be calibrated.
|
static long |
COLLECTION_ENTRY_SIZE
Stores the size of a collection entry (for overhead recording).
|
private static LongHashMap<ArrayList<java.lang.String>> |
CONTEXT_STACKS
Stores the thread-id-context stacks.
|
private static boolean |
doUnallocationRecording
Stores whether unallocation recording shall be done.
|
protected static boolean |
isRecording
Stores if recording is enabled.
|
static long |
MAP_ENTRY_SIZE
Stores the size of a map entry (for overhead recording).
|
private static ArrayList<Plugin> |
plugins
Stores the plugins.
|
protected static long |
programThreadId
Stores the threadId the program started with.
|
private static RecorderStrategy |
STRATEGY
Stores the recording strategy.
|
private static LongLongHashMap |
THREAD_STACKS
Stores the thread stack sizes.
|
instance| Constructor and Description |
|---|
Recorder()
Prevents this class from being instantiated from outside.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assignAllTo(java.lang.String recId,
boolean enter)
Notifies that the following values (if not further calls
to this method or other recording ids occur) should be assigned
to the given
recId. |
private static java.lang.String |
assignId(java.lang.String recId,
java.lang.String caller,
boolean directId)
Assign the proper recording id with respect to the object identity of
the
caller, i.e. check the actual type of
caller and pass adjust the recording id if possible. |
void |
changeValueContext(java.lang.String id,
boolean push)
Notifies the recorder about changing the value context.
|
void |
clearTemporaryData()
Notify that temporary data e.g. from instrumentation shall be cleared.
|
void |
configurationChange(java.lang.String ids)
Notify the recorder that a new variability configuration might have
been entered.
|
(package private) static boolean |
doUnallocationRecording()
Returns whether unallocation recording shall be performed.
|
void |
enableVariabilityDetection(boolean enable)
Changes if automated variability detection should be enabled or not.
|
private static boolean |
endsWith(java.lang.String string,
char chr)
Returns if the specified string ends with a given char.
|
void |
endSystem()
Notifies about the end of the monitored program.
|
void |
enter(java.lang.String caller,
java.lang.String recId,
boolean exclude,
boolean directId,
long instanceId)
Notifies the recorder about a method being called.
|
void |
exit(java.lang.String caller,
java.lang.String recId,
boolean exclude,
boolean directId,
long instanceId)
Notifies the recorder about a method being exited.
|
private static java.lang.String |
getContextualizedValueId(java.lang.String id)
Contextualizes the given id if required.
|
protected static long |
getId(java.lang.Object object)
Returns an unique identification for an object.
|
static void |
initialize()
Cause loading this class.
|
protected boolean |
isRecording()
Returns whether this recorder is recording.
|
void |
memoryAllocated(long tag,
long size)
Notifies the recorder about an object allocated to memory.
|
void |
memoryAllocated(java.lang.Object allocated)
Notifies the recorder about an object allocated to memory.
|
void |
memoryAllocated(java.lang.Object tag,
long size)
Notifies the recorder about an object allocated to memory in the sense
of adjusting an individual allocation due to value notifications.
|
void |
memoryFreed(long tag,
long size)
Notifies the recorder about an object freed from memory.
|
void |
memoryFreed(java.lang.Object freed)
Notifies the recorder about an object freed from memory.
|
void |
memoryFreed(java.lang.Object tag,
long size)
Notifies the recorder about an object freed from memory.
|
void |
notifyProgramEnd()
Notifies about end of monitoring (this might occur at different point
of time than
endSystem() and at multiple times). |
void |
notifyProgramStart()
Notifies about start of monitoring.
|
void |
notifyThreadEnd()
Notifies about the end of the current thread.
|
void |
notifyThreadEnd(long threadId)
Notifies about an ended thread.
|
void |
notifyThreadStart(long newThreadId)
Notifies about a started thread.
|
void |
notifyThreadStart(java.lang.Thread thread)
Notifies about a started thread.
|
void |
notifyTimer(java.lang.String id,
TimerState state,
boolean considerThreads)
Notifies about a timer event.
|
void |
notifyValueChange(java.lang.String recId,
boolean newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
byte newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
char newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
double newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
float newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
int newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
long newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
java.lang.Object newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
short newValue)
Notifies the recorder about a changing value.
|
void |
notifyValueChange(java.lang.String recId,
java.lang.String newValue)
Notifies the recorder about a changing value.
|
private void |
notifyValueChange(java.lang.String recId,
ValueType type,
java.lang.Object newValue)
Notifies the recorder strategy about a changing value.
|
void |
printCurrentState()
Prints the current (aggregated) state to the output formatter.
|
void |
printStatistics()
Emits the values collected so far.
|
int |
readIo(java.lang.String recId,
java.lang.String caller,
int bytes,
StreamType type)
Notifies the recorder about an amount of bytes read from some I/O
channel.
|
void |
registerAsOverheadStream(java.io.InputStream in)
Register the given input stream as overhead stream, i.e. set the
attribute added by instrumentation via reflection so that the recorder
is notified.
|
void |
registerAsOverheadStream(java.io.OutputStream out)
Register the given output stream as overhead stream, i.e. set the
attribute added by instrumentation via reflection so that the recorder
is notified.
|
void |
registerForRecording(java.lang.String className,
MonitoringGroupSettings settings)
Registers a given class for recording.
|
private static void |
registerPlugin(java.lang.String className,
IPluginParameter params)
Registers the given plugin.
|
void |
registerThisThread(boolean register)
Registers a JVM thread with its native counterpart.
|
void |
unallocated(int recId,
long size) |
int |
writeIo(java.lang.String recId,
java.lang.String caller,
int bytes,
StreamType type)
Notifies the recorder about an amount of bytes written to some I/O
channel.
|
public static final long MAP_ENTRY_SIZE
public static final long COLLECTION_ENTRY_SIZE
public static final boolean CALIBRATE_RECORDER
protected static boolean isRecording
protected static long programThreadId
private static final RecorderStrategy STRATEGY
private static final LongHashMap<ArrayList<java.lang.String>> CONTEXT_STACKS
private static final LongLongHashMap THREAD_STACKS
private static boolean doUnallocationRecording
Recorder()
public static void initialize()
private static void registerPlugin(java.lang.String className,
IPluginParameter params)
className - the name of the class to be registeredparams - unrecognized configuration paramspublic final void registerForRecording(java.lang.String className,
MonitoringGroupSettings settings)
ids might be specified to which the measurements are
assigned to. Ids are unique strings without inherent semantics. If
not given, the className is used for grouping and assigning
measurements (implicit 1-groups). [Java call, native call]registerForRecording in class RecorderFrontendclassName - the name of the class measurements should be registered
forsettings - the monitoring group settings including all configuration
information (reference should not be stored, will be freed
explicitly)public final void registerAsOverheadStream(java.io.InputStream in)
registerAsOverheadStream in class RecorderFrontendin - the stream to be registeredpublic final void registerAsOverheadStream(java.io.OutputStream out)
registerAsOverheadStream in class RecorderFrontendout - the stream to be registeredstatic boolean doUnallocationRecording()
true if unallocations shall be performed,
false elsepublic void notifyProgramStart()
notifyProgramStart in class RecorderFrontendpublic void notifyProgramEnd()
endSystem() and at multiple times). [Java call,
native call]notifyProgramEnd in class RecorderFrontendpublic final void enableVariabilityDetection(boolean enable)
enableVariabilityDetection in class RecorderFrontendenable - true if it should be enabled (can be
switched off by annotation) or if manual notification via annotation
should be considered onlypublic final void notifyThreadStart(java.lang.Thread thread)
notifyThreadStart in class RecorderFrontendthread - the started threadpublic final void notifyThreadStart(long newThreadId)
notifyThreadStart in class RecorderFrontendnewThreadId - the identification of the started threadpublic final void notifyThreadEnd()
notifyThreadEnd in class RecorderFrontendpublic final void notifyThreadEnd(long threadId)
notifyThreadEnd in class RecorderFrontendthreadId - the identification of the ended threadpublic final void assignAllTo(java.lang.String recId,
boolean enter)
recId. [Java call, native call]assignAllTo in class RecorderFrontendrecId - the recording id (may be also the variability prefix)enter - true if this is a method enter event,
false elseprotected static final long getId(java.lang.Object object)
object - the object to return the identification forobjectpublic final void endSystem()
endSystem in class RecorderFrontendpublic void enter(java.lang.String caller,
java.lang.String recId,
boolean exclude,
boolean directId,
long instanceId)
enter in class RecorderFrontendcaller - the type of the callerrecId - the recorder id (may be null)exclude - is this an exclusion from monitoringdirectId - is recId direct, e.g. in case of an
annotated methodinstanceId - the optional instance identifier, 0 means
disabledpublic void exit(java.lang.String caller,
java.lang.String recId,
boolean exclude,
boolean directId,
long instanceId)
exit in class RecorderFrontendcaller - the type of the callerrecId - the recorder id (may be null)exclude - is this an exclusion from monitoringdirectId - is recId direct, e.g. in case of an
annotated methodinstanceId - the optional instance identifier, 0 means
disabledpublic void configurationChange(java.lang.String ids)
configurationChange in class RecorderFrontendids - an optional list of group identificationspublic void memoryAllocated(java.lang.Object allocated)
memoryAllocated in class RecorderFrontendallocated - the allocatedpublic void memoryAllocated(long tag,
long size)
memoryAllocated in class RecorderFrontendtag - the identification of the memory object, e.g. its memory
addresssize - the allocated memory sizepublic final void memoryAllocated(java.lang.Object tag,
long size)
memoryAllocated in class RecorderFrontendtag - an object which serves as the identification for object size
to be freedsize - the allocated memory size (considered as increment or
decrement to the actual size)public void memoryFreed(java.lang.Object freed)
Object cannot be instrumented, garbage collector not called
when JVM is running, etc.). [Java call]memoryFreed in class RecorderFrontendfreed - the freed objectpublic final void memoryFreed(java.lang.Object tag,
long size)
memoryFreed in class RecorderFrontendtag - an object which serves as the identification for object size
to be freedsize - the size of the freed object (considered as increment or
decrement to the actual size)public void memoryFreed(long tag,
long size)
Object cannot be instrumented, garbage collector not called
when JVM is running, etc.). [Java call, native call]memoryFreed in class RecorderFrontendtag - the identification of the object to be freed, e.g. its memory
addresssize - the size of the freed object (ignored)public int readIo(java.lang.String recId,
java.lang.String caller,
int bytes,
StreamType type)
readIo in class RecorderFrontendrecId - an the target group identificationcaller - the type of the callerbytes - the number of bytestype - the type of the channelpublic int writeIo(java.lang.String recId,
java.lang.String caller,
int bytes,
StreamType type)
writeIo in class RecorderFrontendrecId - an the target group identificationcaller - the type of the callerbytes - the number of bytestype - the type of the channelprivate static final boolean endsWith(java.lang.String string,
char chr)
string - the string to be testedchr - the char to be searched at the end of stringtrue if c is at the end of
string, false elsepublic void changeValueContext(java.lang.String id,
boolean push)
changeValueContext in class RecorderFrontendid - the value identification representing the contextpush - if true push the context to the context stack,
false elseprivate static final java.lang.String getContextualizedValueId(java.lang.String id)
id - the id to be tested for contextualizingid or null
if id should be contextualized but the context is missingpublic void notifyValueChange(java.lang.String recId,
java.lang.Object newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
int newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
byte newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
char newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
short newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
long newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changeprivate void notifyValueChange(java.lang.String recId,
ValueType type,
java.lang.Object newValue)
recId - the recorder id (optional, may be null)type - the value typenewValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
double newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
float newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
boolean newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changepublic void notifyValueChange(java.lang.String recId,
java.lang.String newValue)
notifyValueChange in class RecorderFrontendrecId - the recorder id (optional, may be null)newValue - the value after the value changeprivate static java.lang.String assignId(java.lang.String recId,
java.lang.String caller,
boolean directId)
caller, i.e. check the actual type of
caller and pass adjust the recording id if possible.recId - the recording id delivered from instrumented code (by the
caller)caller - the name of the type of the calling object (may be
null, e.g. in case of stream classes)directId - is recId direct, e.g. in case of an
annotated methodpublic void printCurrentState()
printCurrentState in class RecorderFrontendpublic void printStatistics()
printStatistics in class RecorderFrontendpublic void notifyTimer(java.lang.String id,
TimerState state,
boolean considerThreads)
notifyTimer in class RecorderFrontendid - the timer identification (may overlap with recorder ids)state - the new timer stateconsiderThreads - false if the id is
thread save and threads must not be considered explicitly,
false elsepublic void registerThisThread(boolean register)
registerThisThread in class RecorderFrontendregister - register or unregister the threadpublic void clearTemporaryData()
clearTemporaryData in class RecorderFrontendprotected boolean isRecording()
true if it is recording, false elsepublic void unallocated(int recId,
long size)
unallocated in interface de.uni_hildesheim.sse.system.IMemoryUnallocationReceiver