PATCH: Add DTrace probes

Roy Lyseng Roy.Lyseng at Sun.COM
Fri Mar 7 13:21:43 UTC 2008


Here is a really simple one based on the "default" entry/return probes 
in all user functions:

Script memcached-entry.d:

pid$target::entry
{
     @syscalls[probefunc] = count();
}

END
{
}

Start dtrace with this script:

dtrace -s memcached-entry.d -p <process if of memcached daemon>

Let it run for a while and interrupt it. The following output is given:

   delete_handler                                                    5
   do_run_deferred_deletes                                           5
   mt_run_deferred_deletes                                           5
   event_tree_RB_REMOVE_COLOR                                        9
   do_slabs_newslab                                                 17
   grow_slab_list                                                   17
   malloc                                                           17
   malloc_unlocked                                                  17
   memory_allocate                                                  17
   morecore                                                         17
   clock_handler                                                    21
   gettimeofday                                                     21
...
   no_preempt                                                   713121
   preempt                                                      713121
   memcpy                                                       844334
   mutex_lock                                                  1032168
   mutex_lock_impl                                             1032168
   mutex_unlock                                                1032168
   clear_lockbyte                                              1032202
   mutex_unlock_queue                                          1032202

This is the pid provider that does not really need any code changes at all.

Roy

Dustin Sallings wrote:
> 
>   For those of us who haven't truly unleashed the power of dtrace, can 
> you describe the kinds of things we can learn from this (perhaps with 
> scripts)?
> 
> --Dustin Sallings (mobile)
> 
> On Mar 6, 2008, at 4:48, Trond Norbye <Trond.Norbye at Sun.COM> wrote:
> 
>>
>> On Mar 5, 2008, at 3:52 PM, Trond Norbye wrote:
>>
>>> The following patch adds a new configure-option (--enable-dtrace) 
>>> that adds DTrace probes to various parts of memcached.
>>>
>>> Please comment.
>>>
>>> Trond
>>
>> I discovered that I had some "leftovers" in this patch from before I 
>> fixed the comments regarding the large page support..
>>
>> The attached version is replacement for the original patch.
>>
>> Trond
>> <dtrace.patch.gz>
>>


More information about the memcached mailing list