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, released in 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 nameDescription arg0arg1 arg2arg3 arg4
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@oracle.com
Last modified: Sun Mar 11 18:01:37 PDT 2012

Copyright © 2005, 2012, Oracle and/or its affiliates. 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, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.

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. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.