Creating a New DTrace Instrument

Create new custom instruments that are tailored to gather data from your app.

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 a custom instrument description.

  5. Enter any declarations that should not go in a probe definition into 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.


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

Custom instruments contain the following configurable 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.

Definitive Discussion