Thanks Jon, your explanation is very helpful. One more question: in this definition, TRACE_1(TR_FAC_IP, TR_IP_RPUT_START, "ip_input_start: q %p", q); only "q" is an argument. Where does the "ip_input_start: q %p" stuff go? Or, what is it used?
Thanks. On Fri, May 30, 2008 at 7:28 PM, Jon Haslam <[EMAIL PROTECTED]> wrote: > >> The comments at the top of sys/vtrace.h explains the background, but >> doesn't state in detail how to use it. In particular, what the type >> and the format of the arguments are. >> >> For example, to monitor this (in uts/common/inet/ip/ip.c) >> TRACE_1(TR_FAC_IP, TR_IP_RPUT_START, "ip_input_start: q %p", q); > > The digit given in the TRACE_?() macros specify how many arguments > are being provided, so with TRACE_1() there is 1 argument. Unfortunately, > the vtrace probes don't have their argument type information exported > so you can't use the args[] array to access them or the '-v' flag > to dtrace(1M). In this case you need to use the source to look at the > arguments and then either use the source or mdb(1) to look at the types. > Then you cast the arguments accordingly. > > So, with your example of vtrace:ip:ip_input:TR_IP_RPUT_START, this > takes a single argument of a queue_t pointer as you state. To use > this just do something like: > > vtrace:ip:ip_input:TR_IP_RPUT_START > { > this->queue = (queue_t *)arg0; > printf("High Water = %d\n", this->queue->q_hiwat); > } > > As I said, to find the definition of a queue_t, either use the > source or mdb: > > # mdb -k > Loading modules: [ unix genunix dtrace specfs ufs scsi_vhci sd isp pcisch > sgsbbc ip hook neti sctp arp fctl nca lofs zfs random ipc sppp cpc ptm nfs > fcip logindmux ] >> ::print -t queue_t > { > struct qinit *q_qinfo > struct msgb *q_first > struct msgb *q_last > struct queue *q_next > struct queue *q_link > <chop> > > Hope this helps. > > Jon. > _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org