Darryl Gove's blog

Friday Aug 29, 2008

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.

Calendar

Search this blog

About

Solaris Application Programming

Book resources

The Developer's Edge

Book resources

OpenSPARC Internals

Book resources

Recent entries

Custom search

Tag cloud

book cmt communityone compiler cooltools cpu2006 dtrace gcc libraries linker multithreading openmp opensolaris opensparc optimisation optimization parallelisation parallelization performance performanceanalyzer programming secondlife solaris solarisapplicationprogramming sparc spot sunstudio ultrasparc ultrasparct2 x86

Links

Webcasts

Articles

Presentations

Interesting docs

Navigation

Referers

Feeds