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 
Comments:

Post a Comment:
Comments are closed for this entry.
About

Darryl Gove is a senior engineer in the Solaris Studio team, working on optimising applications and benchmarks for current and future processors. He is also the author of the books:
Multicore Application Programming
Solaris Application Programming
The Developer's Edge

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
5
6
8
9
10
12
13
14
15
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
The Developer's Edge
Solaris Application Programming
Publications
Webcasts
Presentations
OpenSPARC Book
Multicore Application Programming
Docs