1
/* $XFree86: xc/programs/xtrap/xtrapstats.c,v 1.1tsi Exp $ */
7
* Log: xtrapstats.c,v $
8
* Revision 1.1.4.2 1993/12/14 12:37:41 Kenneth_Miller
9
* ANSI-standardize code and turn client build on
10
* [1993/12/09 20:16:19 Kenneth_Miller]
12
* Revision 1.1.2.2 1992/04/27 13:52:12 Leela_Obilichetti
13
* initial load of xtrap clients - from silver BL6 pool
14
* [92/04/27 13:49:48 Leela_Obilichetti]
18
/*****************************************************************************
19
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993 by Digital Equipment Corp.,
22
Permission to use, copy, modify, and distribute this software and its
23
documentation for any purpose and without fee is hereby granted,
24
provided that the above copyright notice appear in all copies and that
25
both that copyright notice and this permission notice appear in
26
supporting documentation, and that the name of Digital not be
27
used in advertising or publicity pertaining to distribution of the
28
software without specific, written prior permission.
30
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
31
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
32
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
33
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
34
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
35
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
38
*****************************************************************************/
55
#include <X11/extensions/xtraplib.h>
56
#include <X11/extensions/xtraplibp.h>
60
main(int argc, char *argv[])
62
XETrapGetAvailRep ret_avail;
63
XETrapGetStatsRep ret_stats;
75
/* Connect to Server */
76
appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L,
77
(int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp,
79
dpy = XtDisplay(appW);
81
XSynchronize(dpy, True);
83
printf("Display: %s \n", DisplayString(dpy));
84
if ((tc = XECreateTC(dpy,0L, NULL)) == False)
86
fprintf(stderr,"%s: could not initialize extension\n",argv[0]);
90
(void)XEGetAvailableRequest(tc,&ret_avail);
91
if (BitIsFalse(ret_avail.valid, XETrapStatistics))
93
printf("\nStatistics not available from '%s'.\n",
97
XETrapSetStatistics(tc, True);
98
for (i=0; i<256L; i++)
100
BitTrue(requests, i);
102
XETrapSetRequests(tc, True, requests);
103
for (i=KeyPress; i<=MotionNotify; i++)
107
XETrapSetEvents(tc, True, events);
111
fprintf(stderr,"Stats Command (Zero, Quit, [Show])? ");
112
fgets(buffer, sizeof(buffer), stdin);
113
switch(toupper(buffer[0]))
115
case '\n': /* Default command */
116
case 'S': /* Request fresh counters & display */
117
(void)XEGetStatisticsRequest(tc,&ret_stats);
118
(void)XEPrintStatistics(stdout,&ret_stats,tc);
120
case 'Z': /* Zero out counters */
121
XETrapSetStatistics(tc, False);
127
printf("Invalid command, reenter!\n");
132
(void)XCloseDisplay(dpy);