Xserver provider for DTrace


This page provides details on a statically defined user application tracing provider for the DTrace facility in Solaris 10 and later releases. This provider instruments various points in the X server, to allow tracing what client applications are up to.

Binaries

These providers are included in the X server binaries (including Xorg, Xsun, Xvfb, & Xephyr) in recent Solaris releases, including:

Source code

The provider is integrated into the X.Org git master repository for the Xserver 1.4 release, planned to be released in August 2007 with X11R7.3, and into the OpenSolaris X code base for Nevada builds 53 and later.

The 0.1 source patch is built against the Xorg 6.8.2 release (aka X11R6.8.2).

To build, download the base source from http://www.x.org/download.cgi?rel=6.8.2 and then do:

	bzcat X11R6.8.2-src.tar.bz2 | tar -xf -
	gpatch -p1 < 6.8.2-dtrace.patch
	cd xc
	make World

The 0.2 source patch is built against Xorg xserver 1.2 RC1 (aka X11R7.2 RC1).

To build, download the base source from http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.1.99.901.tar.bz2 and then do:

        bzcat xorg-server-1.1.99.901.tar.bz2 | tar -xf -
        cd xorg-server-1.1.99.901
        gpatch -p0 < 7.2-dtrace.patch
        ./configure ; make

Once you're done, you should be able to drop in xc/programs/Xserver/Xorg (6.8.2) or hw/xfree86/Xorg (7.2) as a replacement for /usr/X11/bin/Xorg on a Solaris 10 or Solaris Nevada/Express system.

Examples/samples

Available probes

Due to the way User-Defined DTrace probes work, arguments to these probes all bear undistinguished names of arg0, arg1, arg2, etc. These tables should help you determine what the real data is for each of the probe arguments.

Probe nameDescriptionarg0arg1arg2arg3arg4
Request Probes
request-start Called just before processing each client request. requestNamerequestCode requestLengthclientIdrequestBuffer
request-done (0.1) Called just after processing each client request. requestNamerequestCode requestLengthclientIdresultCode
request-done (0.2) Called just after processing each client request. requestNamerequestCode sequenceNumberclientIdresultCode
Event Probes (added in 0.2)
send-event Called just before send each event to a client. clientIdeventCodeeventBuffer  
Client Connection Probes
client-connect Called when a new connection is opened from a client clientIdclientFD 
client-auth Called when client authenticates (normally just after connection opened) clientIdclientAddrclientPid clientZoneId 
client-disconnect Called when a client connection is closed clientId 
Resource Allocation Probes
resource-alloc Called when a new resource (pixmap, gc, colormap, etc.) is allocated resourceIdresourceTypeIdresourceValueresourceTypeName 
resource-free Called when a resource is freed resourceIdresourceTypeIdresourceValueresourceTypeName 

Data Available in Probe Arguments

To access data in arguments of type string, you will need to use copyinstr(). To access data buffers referenced via uintptr_t's, you will need to use copyin().

Argument nametypeDescription
clientAddrstringString representing address client connected from
clientFDintX server's file descriptor for server side of each connection
clientIdintUnique integer identifier for each connection to the X server
clientPidpid_tProcess id of client, if connection is local (from getpeerucred() )
clientZoneIdzoneid_tZone id of client, if connection is local (from getpeerucred() )
eventBufferuintptr_tPointer to buffer containing X event - decode using structures in <X11/Xproto.h> and similar headers for each extension
eventCodeuint8_tEvent number of X event
resourceIduint32_tX resource id (XID)
resourceTypeIduint32_tResource type id
resourceTypeNamestringString representing X resource type ("PIXMAP", etc.)
resourceValueuintptr_tPointer to data for X resource
resultCodeintInteger code representing result status of request
requestBufferuintptr_tPointer to buffer containing X request - decode using structures in <X11/Xproto.h> and similar headers for each extension
requestCodeuint8_tRequest number of X request or Extension
requestNamestringName of X request or Extension
requestLengthuint16_tLength of X request
sequenceNumberuint32_tNumber of X request in in this connection

Release History

ReleaseDateDescription
0.230-Oct-2006Update for X11R7.2 RC1, add event probe, update request-done probe
0.104-July-2005Initial public release

alan.coopersmith@sun.com
Last modified: Tue Jun 5 10:38:37 PDT 2007

Copyright 2005, 2006, 2007 Sun Microsystems, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.