This sample of a prex session is designed to show the different capabilities of prex. The data collected when cookie is run is shown in "Reading the tnfdump File".
% prex cookie /* prex is loading the executable cookie. */
Target process stopped
Type "continue" to resume the target, "help" for help ...
prex> list sets
$all 'keys'=/.*/ /* One set is defined--$all
(which is all the probes). */
prex> list fcns
&debug tnf_probe_debug /* The debug function is
the only one available. */
prex> list probes $all
name=inloop enable=off trace=on file=cookie.c line=35 funcs=<no value>
name=factor_end enable=off trace=on file=cookie.c line=72 funcs=<no value>
name=factor_start enable=off trace=on file=cookie.c line=61 funcs=<no value>
name=found_a_factor enable=off trace=on file=cookie.c line=67 funcs=<no value>
name=start enable=off trace=on file=cookie.c line=17 funcs=<no value>
prex>/* The line number shows the end of each of the five probes. */
prex> create $factor /factor/ /* Create a new set that
matches any probe whose "keys" */
prex> /* attribute contains the string "factor". */
prex> list sets
$all 'keys'=/.*/
$factor 'keys'=/factor/
/* A new set named "factor"
is created and now shows
up in */
prex>
/* the list of sets. */
prex> list probes $factor
/* This line tells you which probes matched the set
$factor.*/
name=factor_end enable=off trace=on file=cookie.c line=72 funcs=<no value>
name=factor_start enable=off trace=on file=cookie.c line=61 funcs=<no value>
name=found_a_factor enable=off trace=on file=cookie.c line=67 funcs=<no value>
prex> list probes $all /* Check to see if any
probes are enabled. */
name=inloop enable=off trace=on file=cookie.c line=35 funcs=<no value>
name=factor_end enable=off trace=on file=cookie.c line=72 funcs=<no value>
name=factor_start enable=off trace=on file=cookie.c line=61 funcs=<no value>
name=found_a_factor enable=off trace=on file=cookie.c line=67 funcs=<no value>
name=start enable=off trace=on file=cookie.c line=17 funcs=<no value>
prex> /* None are enabled,
but all have trace on. */
prex> enable $all /* Enable all the probes.*/
prex> list probes $all /* Check again to see if any
probes are enabled. */
name=inloop enable=on trace=on file=cookie.c line=35 funcs=<no value>
name=factor_end enable=on trace=on file=cookie.c line=72 funcs=<no value>
name=factor_start enable=on trace=on file=cookie.c line=61 funcs=<no value>
name=found_a_factor enable=on trace=on file=cookie.c line=67 funcs=<no value>
name=start enable=on trace=on file=cookie.c line=17 funcs=<no value
prex> list values name /* Find out what the probe names are. */
name =
factor_end
factor_start
found_a_factor
inloop
start
prex> list values /.*/ /* List all predefined
attributes with their values. */
enable = /* Only unique attributes are listed.*/
on
file =
cookie.c
funcs =
keys =
cookie
factor
find_factor
loop
main
line =
17
35
61
67
72
name =
factor_end
factor_start
found_a_factor
inloop
start
object =
cookie
slots =
factor
input_number
loop_count
searching_for
total_iterations
sunw%debug = /* The user-defined macro, sunw%debug,
is also listed. */
in /* This macro is defined in line 17 of cookie.c. */
loop
main
starting
the
trace =
on
prex> list values object
object =
cookie
prex> connect &debug name=inloop
prex> list /.*/ probes $all /* List all the
information about all the probes */
enable=on trace=on object=cookie funcs=<no value> name=inloop slots=loop_count
total_iterations keys=cookie main loop file=cookie.c line=35 sunw%debug=in the loop
enable=on trace=on object=cookie funcs=<no value> name=factor_end slots=<no value>
keys=factor file=cookie.c line=72
enable=on trace=on object=cookie funcs=<no value> name=factor_start slots=input_number
keys=factor file=cookie.c line=61
enable=on trace=on object=cookie funcs=<no value> name=found_a_factor slots=searching_for
factor keys=cookie find_factor file=cookie.c line=67
enable=on trace=on object=cookie funcs=<no value> name=start slots=<no value> keys=cookie
main file=cookie.c line=17 sunw%debug=starting main
prex> continue
give me a COOKIE! loop
/* An example of loop counts*/
probe inloop; sunw%debug "in the loop"; loop_count=0; total_iterations=0;
probe inloop; sunw%debug "in the loop"; loop_count=1; total_iterations=1;
probe inloop; sunw%debug "in the loop"; loop_count=2; total_iterations=2;
probe inloop; sunw%debug "in the loop"; loop_count=3; total_iterations=3;
probe inloop; sunw%debug "in the loop"; loop_count=4; total_iterations=4;
give me a COOKIE! factor
number you want factored? 25
factors of 25 = 5 5
give me a COOKIE! factor
number you want factored? 43645729
factors of 43645729 = 43645729
give me a COOKIE! ^C Target process stopped
Type "continue" to resume the target, "help" for help...
prex> continue
give me a COOKIE! biscuit
not a biscuit, give me a COOKIE! cookie
not a cookie, give me a COOKIE! COOKIE
thanks!
prex: target process finished