Regarding a Sched Dtrace Script for FreeBSD

abhishek kulkarni abhya007 at gmail.com
Tue Jun 16 18:01:28 UTC 2015


Hello all,



I am working on Dtrace and trying to implement a sched script for FreeBSD
10.0

The script uses the probes on-cpu and off-cpu.

The purpose is to measure the time that a CPU spends on the current thread.

I am trying to use the aggregation function “SUM” to capture the  CPU time
for the ping utility. I am doing it by opening a new putty terminal and
running the ping utility in it, and then running the Dtrace script in
another instance of the terminal.

I am also using the time utility in order to verify the Kernel Time for a
ping. The time given by the “Time” utility and the Dtrace script do not
match. Could you please help with this . The following is the Dtrace script
we are trying out :



sched:::on-cpu

/curthread->td_name == "ping"/

{

  self->ts = timestamp;

}



sched:::off-cpu

/self->ts != 0/

{

  @delta[curthread->td_name] = sum(timestamp - self->ts)/1000000;

  self->ts =0;

}





Looking forward to hear from you.



Regards

Abhishek kulkarni


More information about the freebsd-dtrace mailing list