kdumpcalltime

kdumpcalltime.rb is a small Ruby script for analysing system call traces created using ktrace(1).

As the name suggests, it categorises the dump based on elapsed time spent within system calls. Here's an example run on a quiet MySQL server:

      select: 33.021s/   33 calls = 1.001s per call.  Max=1.001s Min=1.0005s
     sigwait: 2.548s/   75 calls = 0.034s per call.  Max=1.158s Min=0.0004s
        read: 2.537s/  227 calls = 0.011s per call.  Max=1.158s Min=0.0000s
 sigprocmask: 0.004s/  456 calls = 0.000s per call.  Max=0.000s Min=0.0000s
gettimeofday: 0.003s/  340 calls = 0.000s per call.  Max=0.000s Min=0.0000s
       write: 0.002s/  103 calls = 0.000s per call.  Max=0.000s Min=0.0000s
       fcntl: 0.002s/  152 calls = 0.000s per call.  Max=0.000s Min=0.0000s
   getrusage: 0.001s/  144 calls = 0.000s per call.  Max=0.000s Min=0.0000s
    thr_kill: 0.001s/   76 calls = 0.000s per call.  Max=0.000s Min=0.0000s
   setitimer: 0.000s/   76 calls = 0.000s per call.  Max=0.000s Min=0.0000s
clock_gettim: 0.000s/   72 calls = 0.000s per call.  Max=0.000s Min=0.0000s

With this it's easy to see the server is spending most of it's time in select(), sleeping, with other threads waiting in sigwait() and read().

Listing of /files/kdumpcalltime.rb
FilenameFilesizeLast Modified
kdumpcalltime.rb1.04k2009-03-24 01:03