Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2015 11:01:27 -0700
From:      abhishek kulkarni <abhya007@gmail.com>
To:        freebsd-dtrace@freebsd.org
Subject:   Regarding a Sched Dtrace Script for FreeBSD
Message-ID:  <CAJUVset6fHUGkbgLmd-iGRmaRzD9ZBt5wjMkeec9vW2bmnph0g@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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 =E2=80=9CSUM=E2=80=9D to captur=
e 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 =E2=80=9CTime=E2=80=9D utility and the Dtrace s=
cript 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 =3D=3D "ping"/

{

  self->ts =3D timestamp;

}



sched:::off-cpu

/self->ts !=3D 0/

{

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

  self->ts =3D0;

}





Looking forward to hear from you.



Regards

Abhishek kulkarni



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJUVset6fHUGkbgLmd-iGRmaRzD9ZBt5wjMkeec9vW2bmnph0g>