mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-15 19:22:22 +00:00
Add DTrace probe points for X server <-> client communications
See http://people.freedesktop.org/~alanc/dtrace/ for more details
This commit is contained in:
parent
037f23e6f8
commit
49a26681b2
11 changed files with 453 additions and 6 deletions
|
|
@ -72,6 +72,34 @@ dealings in this Software without prior written authorization from Digital
|
|||
Equipment Corporation.
|
||||
|
||||
******************************************************************/
|
||||
/* XSERVER_DTRACE additions:
|
||||
* Copyright 2005-2006 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.
|
||||
*/
|
||||
|
||||
/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
|
||||
|
||||
|
|
@ -125,6 +153,14 @@ Equipment Corporation.
|
|||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
#include <sys/types.h>
|
||||
typedef const char *string;
|
||||
#include "Xserver-dtrace.h"
|
||||
|
||||
#define TypeNameString(t) NameForAtom(ResourceNames[t & TypeMask])
|
||||
#endif
|
||||
|
||||
static void RebuildTable(
|
||||
int /*client*/
|
||||
);
|
||||
|
|
@ -429,6 +465,9 @@ AddResource(XID id, RESTYPE type, pointer value)
|
|||
register ClientResourceRec *rrec;
|
||||
register ResourcePtr res, *head;
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
|
||||
#endif
|
||||
client = CLIENT_ID(id);
|
||||
rrec = &clientTable[client];
|
||||
if (!rrec->buckets)
|
||||
|
|
@ -528,6 +567,11 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
|
|||
if (res->id == id)
|
||||
{
|
||||
RESTYPE rtype = res->type;
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_RESOURCE_FREE(res->id, res->type,
|
||||
res->value, TypeNameString(res->type));
|
||||
#endif
|
||||
*prev = res->next;
|
||||
elements = --*eltptr;
|
||||
if (rtype & RC_CACHED)
|
||||
|
|
@ -569,6 +613,10 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
|
|||
{
|
||||
if (res->id == id && res->type == type)
|
||||
{
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_RESOURCE_FREE(res->id, res->type,
|
||||
res->value, TypeNameString(res->type));
|
||||
#endif
|
||||
*prev = res->next;
|
||||
if (type & RC_CACHED)
|
||||
FlushClientCaches(res->id);
|
||||
|
|
@ -731,6 +779,10 @@ FreeClientNeverRetainResources(ClientPtr client)
|
|||
RESTYPE rtype = this->type;
|
||||
if (rtype & RC_NEVERRETAIN)
|
||||
{
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_RESOURCE_FREE(this->id, this->type,
|
||||
this->value, TypeNameString(this->type));
|
||||
#endif
|
||||
*prev = this->next;
|
||||
if (rtype & RC_CACHED)
|
||||
FlushClientCaches(this->id);
|
||||
|
|
@ -777,6 +829,10 @@ FreeClientResources(ClientPtr client)
|
|||
for (this = *head; this; this = *head)
|
||||
{
|
||||
RESTYPE rtype = this->type;
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_RESOURCE_FREE(this->id, this->type,
|
||||
this->value, TypeNameString(this->type));
|
||||
#endif
|
||||
*head = this->next;
|
||||
if (rtype & RC_CACHED)
|
||||
FlushClientCaches(this->id);
|
||||
|
|
|
|||
Loading…
Reference in a new issue