Hi,
I am trying to figure out how to reduce the performance impact of dtrace when 
run with java probes.  Currently the script that i am running seems to 
significantly impact the performance of my java web app.

I've been trying to use the profile:::profile-1001hz probe to reduce the 
resolution of events processed by dtrace but have had no success (I'm probably 
not using it correctly).

Here is my script, any ideas how I can reduce the overhead?  I am happy to 
reduce the resolution of events that are processed if there is a way to do 
that, or anything else anyone can think of.

thanks.

#!/usr/sbin/dtrace -CZs

self long start;
self short in_lock;
string package_s;
string package_e;

BEGIN
{
    package_s = "com/foo/aaa";
    package_e = "com/foo/zzz";
    start = timestamp;
}

/*
 * hotspot:::method-entry, hotspot:::method-return probe arguments:
 *  arg0: uintptr_t,    Java thread id
 *  arg1: char*,        a pointer to mUTF-8 string containing the name of
 *                          the class of the method being entered
 *  arg2: uintptr_t,    the length of the class name (in bytes)
 *  arg3: char*,        a pointer to mUTF-8 string data which contains the
 *                          name of the method being entered
 *  arg4: uintptr_t,    the length of the method name (in bytes)
 *  arg5: char*,        a pointer to mUTF-8 string data which contains the
 *                          signature of the method being entered
 *  arg6: uintptr_t,    the length of the signature(in bytes)
 */

hotspot$target:::method-return
/self->start && (copyin(arg1, arg2+1) >= package_s && copyin(arg1, arg2+1) <= 
package_e)/
{
    self->str_ptr = (char*) copyin(arg3, arg4+1);
    self->str_ptr[arg4] = '\0';
    self->method_name = (string) self->str_ptr;

    self->str_ptr = (char*) copyin(arg1, arg2+1);
    self->str_ptr[arg2] = '\0';
    self->class_name = (string) self->str_ptr;

    @method_time[self->class_name, self->method_name] = sum((timestamp - 
self->start) / 1000000);
    self->start = NULL;
}

hotspot$target:::method-entry
/(copyin(arg1, arg2+1) >= package_s && copyin(arg1, arg2+1) <= package_e)/
{
    self->start = timestamp;

    self->str_ptr = (char*) copyin(arg1, arg2+1);
    self->str_ptr[arg2] = '\0';
    self->class_name = (string) self->str_ptr;

    self->str_ptr = (char*) copyin(arg3, arg4+1);
    self->str_ptr[arg4] = '\0';
    self->method_name = (string) self->str_ptr;

    self->str_ptr = (char*) copyin(arg5, arg6+1);
    self->str_ptr[arg6] = '\0';
    self->signature = (string) self->str_ptr;

    @method_count[self->class_name, self->method_name] = count();
}

END
{
    printf("\nCOUNT\n======================\n");
    printa(@method_count);
    printf("\nTIME\n======================\n");
    printa(@method_time);
    exit(0);
}
-- 
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to