Creating a New DTrace Instrument

Create new individual instruments that are tailored to gather data from your application.

bullet
To create a new DTrace instrument
  1. Open the Instruments analysis tool.

  2. Select a trace template.

  3. Choose Instrument > Build New Instrument.

  4. Enter the individual instrument description.

  5. Enter global variables for the instrument in the DATA section.

  6. Enter initialization code for the instrument in the BEGIN section.

  7. Enter the probe information.

  8. Enter cleanup code for the instrument in the END section and click Save.

    ../Art/DTrace_instrument_default.png

Customize instruments to your code to reduce the amount of data collected and improve the validity your testing. Create probes to gather only the information relevant to your application.

Custom instruments contain the following sections:

  • Instrument Description: Contains descriptive information about the instrument.

  • DATA declaration: Declare all global variables for custom scripts.

  • BEGIN script: Contains all global variable initialization and instrument startup tasks.

  • Probes: Contains all of the probes for the instrument.

  • END script: Contains all cleanup tasks.