3.3 Adding USDT Probes to an Application

In this section, we practice adding USDT probes to an application. For background information and other details, see Adding Probes to an Application in the Oracle® Linux: DTrace Guide.

To get started, you will need to create a .d file, as described in Defining Providers and Probes in the Oracle® Linux: DTrace Guide.

Note

This .d file is not a script that is run in the same way that is shown in previous examples in this tutorial, but is rather the .d source file that you use when compiling and linking your application. To avoid any confusion, use a different naming convention for this file than you use for scripts.

After creating the .d file, you then need to create the required probe points to use in the following examples. This information is added to the primain.c source file. The probe points that are used in this practice are those listed in the following table. These probes represent a sequence of operations and are used after the user entry is completed and checked.

Table 3.1 Probe Points to Use After User Entry Completed and Checked

Description

Probe

User entry complete and checked

userentry( int )

Return and input to seekFactorA()

factorreturnA( int, int )

Return and input to seekFactorB()

factorreturnB( int, int )

Immediately prior to the program exiting

final()