Fwd: [Xpert]New extension for keeping track of client resources
- From: jg pa dec com (Jim Gettys)
- To: gnome-hackers gnome org
- Subject: Fwd: [Xpert]New extension for keeping track of client resources
- Date: Wed, 6 Mar 2002 14:23:36 -0800 (PST)
For those of you willing to build out of XFree86's CVS, a new tool
that will get you resource usage out of the X server. We should have
done this in 1988. Sigh...
- Jim
--
Jim Gettys
Cambridge Research Laboratory
Compaq Computer Corporation
jg pa dec com
--- Begin Message ---
- From: Mark Vojkovich <mvojkovich nvidia com>
- To: xpert xfree86 org
- Subject: [Xpert]New extension for keeping track of client resources
- Date: Wed, 6 Mar 2002 13:22:38 -0800 (PST)
I've commited a new extension to CVS. It's called "X-Resource"
and it lets you query how many clients are currently running and
how many of each type of resource they have.
I've attached a simple client.
Mark.
/*
gcc -o restest -Wall restest.c -L/usr/X11R6/lib -lX11 -lXext -lXRes
*/
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/extensions/XRes.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
Display *TheDisplay;
int event, error, major, minor, num_clients, i, j, num_types;
XResClient *clients;
XResType *types;
char *name;
TheDisplay = XOpenDisplay(0);
if(!XResQueryExtension(TheDisplay, &event, &error)) {
printf("XResQueryExtension failed\n");
return 1;
}
if(!XResQueryVersion(TheDisplay, &major, &minor)) {
printf("XResQueryVersion failed\n");
return 1;
} else {
printf("X-Resource extension version %i.%i\n", major, minor);
}
XGrabServer(TheDisplay);
XResQueryClients(TheDisplay, &num_clients, &clients);
printf("There are %i clients\n", num_clients);
for(i = 0; i < num_clients; i++) {
XResQueryClientResources(TheDisplay, clients[i].resource_base,
&num_types, &types);
printf("Client %i (base = 0x%x, mask = 0x%x): %i resource types\n", i,
clients[i].resource_base,
clients[i].resource_mask, num_types);
for(j = 0; j < num_types; j++) {
name = XGetAtomName(TheDisplay, types[j].resource_type);
printf(" %s: %i\n", name, types[j].count);
XFree(name);
}
XFree(types);
}
XUngrabServer(TheDisplay);
XFree(clients);
XCloseDisplay(TheDisplay);
return 0;
}
--- End Message ---
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]