You may try this:

Renil Thomas wrote:
> Currently, the d-script used here is as below :
> 
> #!/usr/sbin/dtrace -s
> 
> syscall::write:entry
> /pid == $1 && tid == 3 /
> {
>     self->timestamp_ = timestamp;
>         self->traceme = 1;
> }
> 
> syscall::write:return
> /self->timestamp_ && pid == $1 && tid == 3 /
> {
>     self->traceme = 0;
>         @data["write"] = quantize(timestamp - self->timestamp_);
>     @dataavg["write"] = avg(timestamp - self->timestamp_);

self->need_attention = timestamp - self->timestamp_ > 1000000?1:0;

> }
> 

syscall::write:return
/self->need_attention/
{
    self->need_attention = 0;
    printf("Caught:");
    stack();
    ustack();
    //or something else...
}

> alloccgblk:entry
> /self->traceme/
> {
>         self->timestamp_alloccgblk = timestamp;
> }
> 
> alloccgblk:return
> /self->traceme && self->timestamp_alloccgblk/
> {
>         @data["alloccgblk"] = quantize(timestamp -
>         self->timestamp_alloccgblk); @dataavg["alloccgblk"] =
>         avg(timestamp - self->timestamp_alloccgblk);
> self->timestamp_alloccgblk = 0; 
> 
> }
> 
> mapsearch:entry
> /self->traceme/
> {
>         self->timestamp_mapsearch = timestamp;
> }
> 
> mapsearch:return
> /self->traceme && self->timestamp_mapsearch/
> {
>         @data["mapsearch"] = quantize(timestamp -
>         self->timestamp_mapsearch); @dataavg["mapsearch"] =
>         avg(timestamp - self->timestamp_mapsearch);
> self->timestamp_mapsearch = 0; }
> 
> 
> tick-60sec {
>         printa(@dataavg);
>         printa(@data);
>         exit(0);
> }
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to