Hello,

I need to use the pid provider to trace the inputs and return value of the following function

calc_guest_util(rs_guest_util_t *gutil, int ncpu, int fcpu)
  {
<snip>
   return ((100.0 * (double)used_cycles) / (double)(total_cycles));
  }

I can trace the input arguments with the following dscript (if there's a quicker and cleaver dscript to do that please correct me):

#!/usr/sbin/dtrace -qs

typedef struct rs_guest_util {
        uint64_t        lifespan;
        uint64_t        wallclock_delta;
        uint64_t        active_delta;
        uint64_t        stopped_cycles;
        uint64_t        yielded_cycles;
 } rs_guest_util_t;

pid$1::calc_guest_util:entry
{
self->guest=((rs_guest_util_t *)(copyin(arg0,sizeof(rs_guest_util_t))));
printf("arg0 %x\n",arg0);
printf("ncpu %d\n",arg1);
printf("fcup %d\n",arg2);
printf("active delta %d\n",self->guest->active_delta);
printf("stopped cycles %d\n",self->guest->stopped_cycles);
printf("yielded cycles %d\n",self->guest->yielded_cycles);
}

Then I added the following to trace the return value of the function

pid$1::calc_guest_util:return
{
printf("return %x\n",arg1);
}

But I get the following output:

arg0 ffbffb80
ncpu 8
fcup 0
active delta 583970560
stopped cycles 0
yielded cycles 4652066048
total cycles 4671764480
return ffbffb80

As you can see the return value is an address, actually the same address as arg0 in entry. I suspect I'm doing something wrong in dtrace but I can't realize what....Could you please advice?

Regards
Andrea


/
/
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to