90 likes | 102 Views
This article provides an overview of how to collect and analyze trace data from a Java program using the AdaptJ Agent and AdaptJ Trace Analyzer. It explains the process of recording a trace, analyzing the trace data, and the various options and dependencies involved.
E N D
AdaptJ Sookmyung Women’s Univ. PSLAB
1. 목차 • 1. Overview • 2. Collecting Trace Data using the AdaptJ Agent • 2.1 Recording a Trace • 3. Analyzing Trace Data using AdaptJ Trace Analyzer • 3.1 Overview • 3.2 The Command-Line Interface • 3.3 Dependencies
1. OverView(1) • two primary purposes: • To facilitate the collection of dynamic data concerning the execution of a Java program • To provide a framework for implementing analyses of this collected data quickly and easily • two main goals • The AdaptJ Agent :to collect event trace data • The AdaptJ Trace Analyzer : to read and analyze the traces generated by the agent
2. Collecting Trace Data using the AdaptJ Agent • The AdaptJ Agent • Java Virtual Machine via the Java Virtual Machine Profiler Interface (JVMPI). • to record various types of events • Install Linux & Unix • Sun’s hprof profiler • Another program which uses the JVMPI is Sun’s hprof profiler • The AdaptJ Agent is designed • to record events • The agent accepts a number of command line parameters
The AdaptJ agent should then respond with the following message: • AdaptJ Agent Options =================== file=<output_file> Specifies the name of the output file. Defaults to "AdaptJ.dat" events=<event_char>+ Specifies the events to be recorded counters=<event_char>+ Specifies the events to be counted Usage "help=events" to get a list of event chars split=<size> Specifies the threshold at which a new file is to be started gc=<size> Specifies at which interval to force garbage collection <size> is a number, optionally followed by one of ’k’, ’m’ or ’g’, which stand for ’kilobytes’, ’megabytes’ and ’gigabytes’, respectively. THIS FEATURE IS CURRENTLY BROKEN. pipe Output data to a named piped instead of a regular file quiet Turns off agent messages opt Attempts to reduce the size of the trace file by using compression techniques cp=<path1>+ Specifies the classpath to use for resolving classes cp+=<path1>+ Specifies the classpath to use for resolving classes. The value of the environment variable CLASSPATH is append to the specified list help[=events] Prints this help message. If ’events’ is specified, a list of event chars is output
AdaptJ should display the following message: • AdaptJ Event Mappings ==================== JVMPI_EVENT_ARENA_DELETE A JVMPI_EVENT_ARENA_NEW a JVMPI_EVENT_CLASS_LOAD c JVMPI_EVENT_CLASS_LOAD_HOOK k JVMPI_EVENT_CLASS_UNLOAD C JVMPI_EVENT_COMPILED_METHOD_LOAD l • Example • want to record the Class Load events and the Method Entry Events. • These correspond to ’c’ and ’b’, respectively. Therefore, we would type the following to invoke the agent: • $ java -XrunAdaptJ:events=cb AdaptJTest
3. 1 Overview • Event • Events are read from the trace, they are successively passed to a sequence of chained operations. • Operation • modify the contents of an event • Replace completely a different event • Stop the processing chain -> act as a filter for the subsequent operations in the chain • Pack : grouping of operation • Help organize the various operations • Facilitate their configuration • Contain other pack or operation
3. 2 The Command-line interface • Usage and Option • Usage : java adaptj.Main [option] <trace file> • Option • -q, --quiet : set the quiet mode (m,w,e,0,1,2,3) • -v, --verbose : enables verbose mode • -- version : print the version and exits • --no-gui : disables the graphical progress indicator • -x, --all-off : turns off all operations • -f, --file : read arguments from a file • -r, --refresh-rate :set the amount of time between GUI update • --pipe : forces to read input as if from a pipe • --show-hierarchy : displays the package/operation hierarchy • -t, --time : prints time statistics • --showver : prints the version and continues • -p : set of option for a pack/operation • -cp, --classpath : manipulates the classpath use by AdaptJ • -h, --help : prints help and exits
3. 3 Dependencies • AdaptJ requires every operation to explicitly state two kinds of dependencies • Event dependencies • Which event the operation absolutely requires in order to be able to perform its task • Which event it would like to receive if they are available • Operation dependencies • Which operations in the AdaptJ toolkit provide service for a given application