Darryl Gove's blog
Using dtrace to locate floating point traps
The easiest way to check whether a system is handling floating point traps is to use kstat:
$ kstat |grep fpu_unfinished
fpu_unfinished_traps 178164
or
$ kstat -s fpu_unfinished_traps
module: unix instance: 0
name: fpu_traps class: misc
fpu_unfinished_traps 178164
This reports the number since boot time, so to see if traps are happening, you need to run the command twice and look at the difference.
An alternative way of doing this is to use dtrace to count the number of traps that occur:
$ dtrace -n fbt:genunix:_fp_fpu_simulator:entry'{@a[probefunc]=count();}'
dtrace: description 'fbt:genunix:_fp_fpu_simulator:entry' matched 1 probe
^C
_fp_fpu_simulator 57050
Then its easy to record the pid of the processes generating the traps together with their frequency:
dtrace -n fbt:genunix:_fp_fpu_simulator:entry'{@a[pid]=count();}'
dtrace: description 'fbt:genunix:_fp_fpu_simulator:entry' matched 1 probe
^C
1686 4
1526 19670
1589 20924
The final thing to do is to look at the function names:
$ dtrace -n fbt:genunix:_fp_fpu_simulator:entry'{@a[ustack(1)]=count();}'
dtrace: description 'fbt:genunix:_fp_fpu_simulator:entry' matched 1 probe
^C
app`func1
13426
Posted at 10:04PM Aug 29, 2008 by Darryl Gove in Sun |


