An Introduction to Using BtM's features within TPTP
An Introduction to Using BtM's features within TPTP

Important: This user guide is assumed to be used with TPTP 4.2
The following document provides an overview of using the Build-to-Manage Toolkit (BtM) features currently available within TPTP. These plugins allow the user to instrument their java application using one of three technologies: Application Responses Measurement (ARM), Java Management Extensions (JMX), and Common Base Events (CBE).

Table of Contents:
1.0 Introduction - Description and Purpose
1.1 Requirements
1.2 Downloading BtM
1.3 Known Limitations and Workarounds
1.4 Installing BtM
1.5 Configuring Agent Controller
1.5.1 Configuring Remote Agent Controller (RAC)
1.5.2 Configuring Integrated Agent Controller (IAC)
2.0 Instrument Java Application
2.1 Using filters and Byte code type
2.2 Instrument Java Application using ARM
2.2.1 Viewing ARM data
2.3 Instrument Java Application using JMX
2.3.1 Using Managed Agent Explorer with JMX
2.4 Instrument Java Application using CBE
2.4.1 Viewing CBE logs

1.0 Introduction - Description and Purpose

The Build-to-Manage Toolkit for Java Instrumentation promotes a set of management standards that have been available for Java programmers for some time. This document describes how to use these management standards to help instrument user code for response time measurement, management, and event creation.


1.1 Requirements

BtM is developed based-on TPTP 4.2. BtM supports two byte code instrumentation mechanism: Probekit and AspectJ.

  1. Install Eclipse 3.2+
  2. TPTP 4.2+
  3. Technology Previews Monitoring Instrumentation, Managed Agent Explorer, ARM UI
  4. AspectJ requires AJDT 1.4

1.2 Downloading BtM

Follow the steps below to obtain a copy of BtM:

  1. Install Eclipse 3.2: http://www.eclipse.org
  2. Click on the 'Latest Downloads' link from TPTP's home page: http://www.eclipse.org/tptp
  3. Select the version and the build that you wish to download. BtM was introduced in TPTP 4.2. Select a build corresponding to TPTP 4.2+.
  4. Once a desired build is selected, find and download the following items:
    • TPTP Runtime or SDK (ALL - Which includes Platform, Monitoring Tools, Tracing and Profiling Tools, and Testing Tools)
    • Agent Controller (For a desired platform)
    • Technology Preview Managed Agent Explorer and Monitoring Instrumentation
    • Technology Preview ARM UI plug-in
    • Obtain all items listed under 'Requirements'
  5. Install AJDT 1.4 (optional. If you want to use AspectJ weaving technology, you must install AJDT).


The list below indicates some of the known limitations of the BtM.

  • Selecting two different analysis types each under a differnet collector will display the analysis type twice. 146854
  • Using MX4J jars for the JMX instrumentation include the following exclude items in the Instrumentation Filter.
    • mx4j*    *    *    exclude
    • *           $*    *    exclude
    Not excluding the following filter items can cause stack overflow error.

  1. Unzip required Eclipse component packages to the Eclipse installation directory, for example, D:\eclipse
  2. Unzip the TPTP package into the Eclipse installation directory, for example, D:\eclipse.
  3. Unzip the follow Technology Preview files into the Eclipse installation directory, for example, D:\eclipse.
    • Monitoring instrumentation
    • Managed Agent Explorer
    • ARM UI plug-in

BtM supports both Remote Agent Controller (RAC) and Integrated Agent Controller (IAC).

  1. Click on the 'Latest Downloads' link from TPTP's home page: http://www.eclipse.org/tptp and select the version and the build that you wish to download.
  2. Select a convenient download mirror and save the zip file.
  3. To install the Agent Controller, unzip the zip file into a directory of your choice (e.g. c:\raserver). For information on setting up and running Agent Controller, see the Agent Controller Getting Started Guide include in the zip.
  4. Stop the Agent Controller
  5. Unzip the Technology Preview (ARM Engine installed on the RAC) - RAC into the Agent Controllers plugin directory, for example, c:\raserver\plugins.
  6. Unzip the Technology Preview (Monitoring Instrumentation for RAC) - RAC into the Agent Controllers plugin directory, for example, c:\raserver\plugins.
  7. Start the Agent Controller

  1. Unzip the Technology Preview (ARM Engine installed on the RAC) into the Integrated Agent Controller's extensions directory, for example, C:\eclipse\plugins\org.eclipse.hyades.execution_4.4.0.v200705240834\iac-runtime\extensions.
  2. Unzip the Technology Preview (Monitoring Instrumentation for the agent controller) into the Integrated Agent Controller's extensions directory, for example, C:\eclipse\plugins\org.eclipse.hyades.execution_4.4.0.v200705240834\iac-runtime\extensions.
  3. Restart the Eclipse workbench.

All java instrumentation takes placing using the Profile menu option and Profiling wizard available within TPTP. BtM Application Response Measurement (ARM) instrumentation places in the ARM start and stop calls for the specified methods selected in the Instrument filter.

BtM Java Management Extension (JMX) instrumentation automatically registers ModelMBeans (with required metadata) for the specified methods and member variables using an after advice (or exit fragment). BtM preferences determine which MBean server is to be used. The user can have JMX notifications sent for failures, successes, JMX attribute changes, and method execution time.

The BtM Common Base Events model formats log events to a specific XML schema. Events are derived from situations that the user selects in the event wizard. BtM�s CBEs indicate the exception thrown and the stack trace of the entry and exit method.

In the Instrument Collector filters can be added or removed to help the user determine what packages, classes, and/or methods to be include or exclude during instrumentation. Filters can be configured from the Instrument Collector -> Edit Options.

  1. Instrument Data Collector, the desired filters for instrument packages, classes or methods can be applied. For the purposes of this example, Select Default filter set.


    Figure 2.1 - Instrument Collector Filter

  2. Click Add to the right of the list of rules to add a new rule to the filter set. For example, add samle.bookstore in the Package field and * in the Class field and Method name field, select INCLUDE for the Rule, then click OK.


    Figure 2.2 - Add filter

  3. Click Next you must select the Byte Code Type you want to instrument your applications. Two instrumentation types are available: Probes and AspectJ. To select AspectJ type Byte Code, you must install AJDT 1.4.0; otherwise AspectJ will not be listed as an option.
  4. Click Finish

  1. To monitor an application using ARM, select File Menu > Run > Profile.... The Profiling wizard opens.
  2. In the left pane (Configurations), select Java Application.
  3. Click New. A new configuration is created with the default name New_configuration.
  4. On the Main tab, browse to the Project and Main class that you want to profile.
  5. From the Profile Configuration screen select the Monitor tab -> Application Response Measurement Analysis under the Instrument Collector.


    Figure 2.3 - Select ARM Analysis Type

  6. Press the Profile button at the bottom to run your application with ARM Instrumentation.

The Application Response Measurement Analysis type provides a number of different views and tables to help visualize the profiling data.

  1. Select Application Response Measurement Analysis in the Profiling Monitor tab and right click to list the available views.


    Figure 2.4 - ARM views

  2. After select the desired view the ARM data will be displayed

  1. To monitor an application using JMX, select File Menu > Run > Profile.... The Profiling wizard opens.
  2. In the left pane (Configurations), select Java Application.
  3. Click New. A new configuration is created with the default name New_configuration.
  4. On the Main tab, browse to the Project and Main class that you want to profile.
  5. From the Profile Configuration screen select the Monitor tab -> Java Management Extension Analysis under the Instrument Collector.
  6. Press the Profile button at the bottom to run your application with JMX Instrumentation.
  7. In the Profiling Console register mbeans names will be displayed.

The Monitoring Instrumentation UI plug-in includes an implementation for JMX against org.eclipse.tptp.monitoring.managedagent.internal.ManagedResourceAgent. We can use the managed agent explorer to view those created and registered MBeans during the above instrumentation.

  1. To view the MBeans created, select File Menu > Run > Profile.... The Profiling wizard opens.
  2. In the left pane (Configurations), select Managed Resource.
  3. Click New. A new configuration is created with the default name New_configuration.
  4. Select JMX resource under Monitor tab, and press the Edit Options button to configure JMX Service URL address.
    • The Edit Options allows the user to specify the either to use the Embedded JMX MBean Server or specify a remote server.
    • If you want to retrieve the MBeans which are created and registered by Monitoring Instrumentation plug-in, you have to choose Embedded MBeanServer. If you want to view resources on any other MBeanServer, please choose Remote MBeanServer.

    Figure 2.5 - Create Resource Browser

  5. Press the Profile button.
  6. Right-click a MBean Server and select Launch agent to launch a new agent to view the details of this selected MBean.
    Figure 2.6 - Select Resource Browser

  7. The Managed Agent Explorer shows the registered mbeans for the selected MBean Server. To retrieve the attributes and operations right-click on an mbean and select Launch agent.
  8. The mbean info is broken into either properties (attributes in JMX) or operations.
    • To invoke attributes select the property in the Managed Agent Browser, change the value and push enter.
      Figure 2.7 - Change Property

    • To invoke operations select the operation in the Managed Agent Browser, fill in the required parameters and push the invoke button.
      Figure 2.8 - Change Property

  1. To monitor an application using CBE, select File Menu > Run > Profile.... The Profiling wizard opens.
  2. In the left pane (Configurations), select Java Application.
  3. Click New. A new configuration is created with the default name New_configuration.
  4. On the Main tab, browse to the Project and Main class that you want to profile.
  5. From the Profile Configuration screen select the Monitor tab -> Common Base Event Analysis under the Instrument Collector.
  6. Click Edit Option to set CBE Configuration information.
    • CBE Factory Home Implementation Selection: define CBE Factory Home Implementation Class, User Defined ContentHandler Class and User Defined Template File.
    • CBE Scenario Selection: select Method CBE Instrument or Callsite CBE Instrument scenario.
    • Instrument Type Selection: for Method CBE Instrument, it provides three instrument types: Method Catch - log event while there is an exception, Method Entry - log event while entry a method and Method Exit - log event while exit a method; for Callsite CBE Instrument, it provides two instrument types: Before Call Method - log event before the method is called and After Call Method - log event after the method is called.
    • IV. CBE Output Selection: select output CBE messages to Logging Agent or Console.



    • Figure 2.9 - CBE Options

  7. Click Finish
  8. Press the Profile button at the bottom to run your application with CBE.

CBE have to output formats Logging Agent or Console. For the Console the CBE message are displayed in the Profiling perspective console. Follow the steps below to view the CBE messages in the Logging Agent.

  1. For Selecting output CBE to Logging Agent, A new item CBE Analysis Logging Agent appears in Profiling and Logging view.
  2. Right-Click CBE Analysis Logging Agent to Select Open With... >Log View from popup menu.
  3. CBE messages will be listed in Log view