The numbers 1 through 5 in the argument names are used here to illustrate the number of variables you give to the probe point. For example, the syntax for TNF_PROBE_1 is:
TNF_PROBE_1(name, keys, detail, arg_type_1, arg_name_1, arg_value_1);
and the syntax for TNF_PROBE_5 is:
TNF_PROBE_5(name, keys, detail, arg_type_1, arg_name_1, arg_value_1 arg_type_2, arg_name_2, arg_value_2 arg_type_3, arg_name_3, arg_value_3 arg_type_4, arg_name_4, arg_value_4 arg_type_5, arg_name_5, arg_value_5);
The arguments are:
arg_type_n--The type of the nth argument. n is a number from 1 through 5. The predefined types are listed in Table 1-9. See "Defining User Types for Probe Points" for information about defining your own types.
arg_name_n--The name you give the nth argument. Follow the ANSI C rules for identifiers, and do not use quotation marks around the argument name. (Note that the slots attribute mentioned on "Attributes " contains a string version of this name.)
arg_value_n--The expression that is evaluated to a value that is included in the trace file. A read access is done on any variables that are mentioned in value_n. In a multithreaded program, place locks around the TNF_PROBE_n macro if value_n contains data that should be read protected.
Type |
Associated C Type and Semantics |
---|---|
tnf_long |
int, long |
tnf_ulong |
unsigned int, unsigned long |
tnf_longlong |
long long (if implemented in compilation system) |
tnf_ulonglong |
unsigned long long (if implemented in compilation system) |
tnf_float |
float |
tnf_double |
double |
tnf_string |
char * |
tnf_opaque |
void * |
For example, the cookie.c program on "A Sample C Program" uses TNF_PROBE_2 as follows:
TNF_PROBE_2(inloop, "cookie main loop","sunw%debug in the loop", tnf_long, loop_count, i, tnf_long, total_iterations, sum);
Table 1-10 explains some of the macro definitions in cookie.c.
Table 1-10 TNF Macro Definitions in cookie.c
TNF_PROBE_0 ( |
A probe with no argument types |
start, |
The name of the probe |
"cookie main", |
The list of groups the probe belongs to cookie and main (the values of the keys attribute) |
"sunw%debug starting main"); |
User-defined attribute=sunw%debug; value=starting main (used by debug probe function) |
TNF_PROBE_2 ( |
A probe with two variables |
inloop, |
The name of the probe |
"cookie main loop", |
The keys - cookie, main, and loop |
"sunw%debug in the loop", |
Values for the debug probe function |
tnf_long, |
The type of the first variable |
loop_count, |
The name of the first variable (value of the slots attribute) |
i, |
The first variable |
tnf_long, |
The type of the second variable |
total_iterations, |
The name of the second variable (value of the slots attribute) |
sum); |
The second variable |
""); |