0

I'm trying to execute the following very simple use of DTrace from the terminal in OS X 10.8.

sudo dtrace -n 'syscall:::entry { @counts["System Call Entry"] = count(); }'

When I hit ^C I expect the aggregate @counts to be printed out, but instead I just get a blank line printed out. Could someone please tell me why the aggregate isn't being printed?

It's really odd because if I execute the following script, I do see a printout of the aggregation, so the aggregation does have values stored in it.

sudo dtrace -n 'syscall:::entry { @counts[probefunc] = count(); } tick-1sec { printa(@counts); exit(0); }'

James Bedford
  • 28,702
  • 8
  • 57
  • 64

1 Answers1

0

You must leave the probe running a little bit longer for it to set-up and collect some numbers. I found that it takes between 1 and 10 seconds to actually start/collect, only then can you get the aggregate result to print after hitting ^C.

This delay is noticeable on OSX and Solaris, but why it takes a lot longer from time to time I have not been able to determine. [There is a perfectly logical (and unknown) reason of course.]

Also, if you add:

dtrace:::BEGIN { printf("Starting...\n"); }

into your probe, you see the delayed start. However, it then takes a bit more time to collect the first set of numbers. It won't print the "aggregate" until the syscall:::entry probe has fired and accumulated something.

PaulS
  • 334
  • 2
  • 11