Go to main content

Oracle® Solaris 11.4 DTrace (Dynamic Tracing) Guide

Exit Print View

Updated: September 2020
 
 

Programming APIs

dtrace_prog_t *dtrace_program_strcompile(dtrace_hdl_t *dtp, const char *s, dtrace_probespec_t spec, uint_t cflags, int argc, char *const argv[])

Compiles a D script that is contained in a string. The value returned is passed to some other functions, like dtrace_program_exec(). See dtrace_program_strcompile(3DTRACE).

dtrace_prog_t *dtrace_program_fcompile(dtrace_hdl_t *dtp, FILE *fp, uint_t cflags, int argc, char *const argv[])

Compiles a D script contained in an external file. The value returned is passed to some of the functions below, like dtrace_program_exec(). See dtrace_program_fcompile(3DTRACE).

int dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, dtrace_proginfo_t *pip)

Downloads a compiled DTrace program into the kernel DTrace framework. Probes are enabled during this function call. Information about the program being executed is returned in the pip argument. For more information, see dtrace_program_info(). See dtrace_program_exec(3DTRACE).

void dtrace_program_info(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,dtrace_proginfo_t *pip)

Provides information about the program pgp is returned in the pip argument. This information is described in the dtrace_proginfo_t data structure. See dtrace_program_info(3DTRACE).

int dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, const char *file, int objc, char *const objv[])

Processes the object files specified in _objv_ (with a count of those files in _objc_) to create the probe points for that provider, with a given compiled USDT provider definition as _pgp_. See dtrace_program_link(3DTRACE).

int dtrace_program_header(dtrace_hdl_t *dtp, FILE *out, const char *fname)

Generates a C header file containing the macro definitions for a USDT provider. This header file is written to _out_. The name of the file, _fname_, is used in the header file. The name of the file, _fname_, is used in the header file. The information about the provider is stored in the DTrace handle _dtp_ after dtrace_program_strcompile() or dtrace_program_fcompile() is called to compile the D language provider definition. See dtrace_program_header(3DTRACE).

void *dtrace_dof_create(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t flags)

Returns a pointer to the D object for this program for a given compiled DTrace program pgp. DOF is the D Object Format, which is the DTrace equivalent of ELF. DOF is downloaded into the kernel during dtrace_program_exec(). See dtrace_dof_create(3DTRACE).

void dtrace_dof_destroy(dtrace_hdl_t *dtp, void *dof)

Frees any resources associated with the DOF. See dtrace_dof_destroy(3DTRACE).

void *dtrace_getopt_dof(dtrace_hdl_t *dtp)

Returns the DOF containing information about options that have been set by using dtrace_setopt(). This information is an array containing option identifiers and their values. See dtrace_getopt(3DTRACE).

void *dtrace_geterr_dof(dtrace_hdl_t *dtp)

Returns the DOF containing the code to execute for any ERROR clauses in a D script. These clauses are handled differently from the BEGIN and END clauses.

int dtrace_stmt_iter(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,dtrace_stmt_f *func, void *data)

Iterates over the statements associated with _pgp_, calling the function _func_ on each statement. See dtrace_stmt_iter(3DTRACE).