Creating probes

To create a probe, first create a Probekit source file (probe file) in a Probekit project. Then, in the Probekit source file, create the probe and add the contents that define how the probe works.

Prerequisite: Creating a Probekit project
To create a Probekit source file, you must use the Probekit Source File wizard. You can continue to use the wizard to create the probe and to write most of the probe definition, or you can go directly to the Probekit editor. In either case, you must use the Probekit editor to write the Java™ code fragment for the code.

For detailed information about the parts of a probe, see Probe definitions.

  1. To create the Probekit source file:
    1. In the Navigator or Package Explorer view, right-click the Probekit project that you want to contain the source file, then click New > Other.
    2. On the Select a wizard page, expand Profiling and Logging and select Probekit Source File.
    3. Click Next.
    4. In the Create a New Probe File wizard, type a name for the new probe source file in the File name field. The file name extension for Probekit source files must be .probe.
    5. In the Source Folder field, enter a project source folder to contain the new Probekit source file.
      Note: Probekit source files must appear in the top level of a project source folder; they cannot be in a subfolder.
  2. If you want to exit the wizard now and use the Probekit editor to create your probe and its definition:
    1. Select No Content.
    2. Click Finish. The new Probekit source file is added in the project source folder and, by default, automatically opens in the Probekit editor.
    3. Continue with step 4.
  3. If you want to continue to use the wizard to assist you in creating the probe definition:
    1. Select Method Probe or Callsite Probe.
    2. Select the Fragment Type value for the fragment that you want the wizard to create.
    3. Click Next.
    4. Define as much of the content for the probe as you want using Add and Edit. When you add or select an item, the wizard displays a description of it.
      Note: If you go back and change the type of probe being created or the fragment type to be inserted, the editor will prompt you to discard any items that no longer apply.
    5. Click Finish. The new Probekit source file is added in the project source folder and, by default, automatically opens in the Probekit editor.
  4. Optional: On the General page of the Probekit editor, enter a unique ID string for the probe in the ID field, and a version number in the Version field, as well as values for a label. This data is only for your use in identifying the probe.
  5. Click the Probes tab.
  6. If you did not use the wizard to create the probe, click Add Probe. The new probe is listed in the tree pane on the left side of the page.
  7. Right-click the probe in the tree pane, then click New > Fragment. The new fragment appears in the tree pane as a child of the probe, and the property fields for the fragment are displayed in the edit pane on the right side of the page.
  8. In the edit pane, select a Fragment Type value, then type your Java code for the probe fragment. For specific information, see Probe fragment types.
  9. Continue defining your probe by right-clicking items in the tree, using the pop-up menu to add child items, and typing values for the new items in the edit pane. The pop-up menu lists only the items that are valid for the location that is selected in the tree. If the item is valid but can no longer be added in the selected location, the item is disabled in the menu.
    Note: When you type a value in the Import directive property field, type only the name of the package or class that you want to import. Do not type the import keyword or the final semicolon (;).
  10. When you have finished defining your probe, click File > Save.
    Note: When you save the Probekit source file, the Probekit editor checks the syntax of all Java elements in the file and reports any javac problems. If there is an error or warning for an entry, the corresponding icon in the tree changes to the error or warning icon. Javac problems are displayed in a table at the lower edge of the Probes page. Double-click an item in this table to focus on the item for editing.
Related concepts
Probekit reference
Related tasks
Modifying probes
Creating a Probekit project
Managing the Probekit registry
Related reference
The Probekit editor
Probekit examples
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.