DTrace on Lion is not executing ending actions

Originator:chris
Number:rdar://10633166 Date Originated:12/30/2011
Status:Open Resolved:
Product:OS X Product Version:10.7.2
Classification:Other bug Reproducible:Always
 
30-Dec-2011 09:17 PM Chris DeSalvo:
Summary:
When a DTrace run completes it is supposed to dump the state of all declared aggregations.  This does not seem to be happening on Lion.

Steps to Reproduce:

0.  Save the following DTrace D script to a file called no-output.d

/*   start of file  */

syscall::write:entry
{
    self->ts = timestamp;
}

syscall::write:return
/self->ts/
{
    @time[execname] = avg(timestamp - self->ts);
    self->ts = 0;
}

/*   end of file  */

1.  run it thusly:  sudo dtrace -s no-output.d

2.  let it run for 10 seconds or so and then press ^C.

Expected Results:
You should get some output showing the average time for calls to the 'write' syscall.

  X11.bin                                                       20110
  Terminal                                                      20408
  socketfilterfw                                                23175
  ssh                                                           32593
  Google Chrome                                                147736
  Google Chrome H                                              592872
  Adium                                                       1886194

Actual Results:
I get no output

Regression:
This script works fine on 10.6.8 but doesn't work on 10.7.2.

Notes:

If you enhance the script by adding explicit actions for the ending of the trace execution you find that they don't run at all.  Follow the same steps as above with the following D script:

/*  start of file  */

BEGIN
{
    printf("This prints\n");
}

dtrace:::BEGIN
{
    printf("This also prints.\n");
}

syscall::write:entry
{
    self->ts = timestamp;
}

syscall::write:return
/self->ts/
{
    @time[execname] = avg(timestamp - self->ts);
    self->ts = 0;
}

dtrace:::END
{
    printf("This doesn't\n");
}

END
{
    printf("Neither does this\n");
    printa(@time);
}

/*  end of file  */

The only output generated is the lines that are in the explicit BEGIN blocks.  The default ending action (dumping of all aggregations) and the two explicit END blocks do not run (or if they do they do their output is squelched).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!