head 1.2; access; symbols netbsd-7-2-RELEASE:1.1.1.3 netbsd-7-1-2-RELEASE:1.1.1.3 netbsd-7-1-1-RELEASE:1.1.1.3 netbsd-7-1:1.1.1.3.0.14 netbsd-7-1-RELEASE:1.1.1.3 netbsd-7-1-RC2:1.1.1.3 netbsd-7-1-RC1:1.1.1.3 netbsd-7-0-2-RELEASE:1.1.1.3 netbsd-7-0-1-RELEASE:1.1.1.3 netbsd-7-0:1.1.1.3.0.12 netbsd-7-0-RELEASE:1.1.1.3 netbsd-7-0-RC3:1.1.1.3 netbsd-7-0-RC2:1.1.1.3 netbsd-7-0-RC1:1.1.1.3 netbsd-5-2-3-RELEASE:1.1.1.1 netbsd-5-1-5-RELEASE:1.1.1.1 netbsd-6-0-6-RELEASE:1.1.1.3 netbsd-6-1-5-RELEASE:1.1.1.3 netbsd-7:1.1.1.3.0.10 netbsd-7-base:1.1.1.3 netbsd-6-1-4-RELEASE:1.1.1.3 netbsd-6-0-5-RELEASE:1.1.1.3 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.3 riastradh-drm2:1.1.1.3.0.8 riastradh-drm2-base:1.1.1.3 netbsd-6-1-3-RELEASE:1.1.1.3 netbsd-6-0-4-RELEASE:1.1.1.3 netbsd-5-2-2-RELEASE:1.1.1.1 netbsd-5-1-4-RELEASE:1.1.1.1 netbsd-6-1-2-RELEASE:1.1.1.3 netbsd-6-0-3-RELEASE:1.1.1.3 netbsd-5-2-1-RELEASE:1.1.1.1 netbsd-5-1-3-RELEASE:1.1.1.1 netbsd-6-1-1-RELEASE:1.1.1.3 xorg-server-1-10-6:1.1.1.3 netbsd-6-1:1.1.1.3.0.6 netbsd-6-0-2-RELEASE:1.1.1.3 netbsd-6-1-RELEASE:1.1.1.3 netbsd-6-1-RC4:1.1.1.3 netbsd-6-1-RC3:1.1.1.3 netbsd-6-1-RC2:1.1.1.3 netbsd-6-1-RC1:1.1.1.3 netbsd-5-2:1.1.1.1.0.8 netbsd-6-0-1-RELEASE:1.1.1.3 netbsd-5-2-RELEASE:1.1.1.1 netbsd-5-2-RC1:1.1.1.1 netbsd-6-0:1.1.1.3.0.4 netbsd-6-0-RELEASE:1.1.1.3 netbsd-6-0-RC2:1.1.1.3 netbsd-6-0-RC1:1.1.1.3 netbsd-6:1.1.1.3.0.2 netbsd-6-base:1.1.1.3 netbsd-5-1-2-RELEASE:1.1.1.1 netbsd-5-1-1-RELEASE:1.1.1.1 xorg-server-1-10-3:1.1.1.3 mrg-xorg-server-1-9-5-pre-1-10-3:1.1.1.2 xorg-server-1-9-5:1.1.1.2 xorg-server-1-9-2:1.1.1.2 netbsd-5-1:1.1.1.1.0.6 netbsd-5-1-RELEASE:1.1.1.1 netbsd-5-1-RC4:1.1.1.1 netbsd-5-1-RC3:1.1.1.1 netbsd-5-1-RC2:1.1.1.1 netbsd-5-1-RC1:1.1.1.1 netbsd-5-0-2-RELEASE:1.1.1.1 xorg-server-1-6-5:1.1.1.1 xorg-server-1-6-3:1.1.1.1 netbsd-5-0-1-RELEASE:1.1.1.1 xorg-server-1-6-2:1.1.1.1 xorg-server-1-6-1-901:1.1.1.1 netbsd-5-0:1.1.1.1.0.4 netbsd-5-0-RELEASE:1.1.1.1 netbsd-5-0-RC4:1.1.1.1 netbsd-5-0-RC3:1.1.1.1 netbsd-5-0-RC2:1.1.1.1 netbsd-5-0-RC1:1.1.1.1 netbsd-5:1.1.1.1.0.2 netbsd-5-base:1.1.1.1 xorg-server-1-4-2:1.1.1.1 xorg:1.1.1; locks; strict; comment @# @; 1.2 date 2016.08.11.00.04.28; author mrg; state dead; branches; next 1.1; commitid FQxwnZNPy5ZgOOhz; 1.1 date 2008.07.31.19.50.31; author mrg; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2008.07.31.19.50.31; author mrg; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2010.11.23.05.21.21; author mrg; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2011.08.02.06.56.51; author mrg; state Exp; branches; next ; desc @@ 1.2 log @first merge of netbsd changes. not tested yet. @ text @
#include "dmx.h"#include "dmxstat.h"#include "dmxlog.h"#include "Xos.h"Data Structures | |
| struct | _DMXStatAvg |
| struct | _DMXStatInfo |
Typedefs | |
| typedef _DMXStatAvg | DMXStatAvg |
Functions | |
| void | dmxStatActivate (const char *interval, const char *displays) |
| DMXStatInfo * | dmxStatAlloc (void) |
| void | dmxStatFree (DMXStatInfo *pt) |
| void | dmxStatSync (DMXScreenInfo *dmxScreen, struct timeval *stop, struct timeval *start, unsigned long pending) |
| void | dmxStatInit (void) |
Variables | |
| int | dmxStatInterval |
|
|
Used to compute a running average of value. |
|
||||||||||||
|
Turn on XSync statistic gathering and printing. Print every interval seconds, with lines for the first displays. If interval is NULL, 1 will be used. If displays is NULL, 0 will be used (meaning a line for every display will be printed). Note that this function takes string arguments because it will usually be called from ddxProcessArgument in #dmxinit.c. |
|
|
Allocate a DMXStatInfo structure. |
|
|
Free the memory used by a DMXStatInfo structure. |
|
|
Try to initialize the statistic gathering and printing routines. Initialization only takes place if dmxStatActivate has already been called. We don't need the same generation protection that we used in dmxSyncInit because our timer is always on a queue -- hence, server generation will always free it. |
|
||||||||||||||||||||
|
Note that a XSync() was just done on dmxScreen with the start and stop times (from gettimeofday()) and the number of pending-but-not-yet-processed XSync requests. This routine is called from #dmxDoSync in #dmxsync.c |
|
#include "dmx.h"#include "dmxstat.h"#include "dmxlog.h"#include <X11/Xos.h>Data Structures | |
| struct | _DMXStatAvg |
| struct | _DMXStatInfo |
Typedefs | |
| typedef struct _DMXStatAvg | DMXStatAvg |
Functions | |
| static unsigned long | usec (struct timeval *stop, struct timeval *start) |
| static unsigned long | avg (DMXStatAvg *data, unsigned long *max) |
| void | dmxStatActivate (const char *interval, const char *displays) |
| DMXStatInfo * | dmxStatAlloc (void) |
| void | dmxStatFree (DMXStatInfo *pt) |
| static void | dmxStatValue (DMXStatAvg *data, unsigned long value) |
| void | dmxStatSync (DMXScreenInfo *dmxScreen, struct timeval *stop, struct timeval *start, unsigned long pending) |
| static CARD32 | dmxStatCallback (OsTimerPtr timer, CARD32 t, pointer arg) |
| void | dmxStatInit (void) |
Variables | |
| int | dmxStatInterval |
| static int | dmxStatDisplays |
| static OsTimerPtr | dmxStatTimer |
The DMX server code is written to call dmxSync() whenever an XSync() might be necessary. However, since XSync() requires a two way communication with the other X server, eliminating unnecessary XSync() calls is a key performance optimization. Support for this optimization is provided in dmxsync.c. This file provides routines that evaluate this optimization by counting the number of XSync() calls and monitoring their latency. This functionality can be turned on using the -stat command-line parameter.
| typedef struct _DMXStatAvg DMXStatAvg |
Used to compute a running average of value.
| static unsigned long avg | ( | DMXStatAvg * | data, | |
| unsigned long * | max | |||
| ) | [static] |
References _DMXStatAvg::count, and _DMXStatAvg::value.
d22 2 a23 1Referenced by dmxStatCallback().
d25 2 a26 85| void dmxStatActivate | ( | const char * | interval, | |
| const char * | displays | |||
| ) |
Turn on XSync statistic gathering and printing. Print every interval seconds, with lines for the first displays. If interval is NULL, 1 will be used. If displays is NULL, 0 will be used (meaning a line for every display will be printed). Note that this function takes string arguments because it will usually be called from ddxProcessArgument in dmxinit.c.
References dmxStatDisplays, and dmxStatInterval.
Referenced by ddxProcessArgument().
| DMXStatInfo* dmxStatAlloc | ( | void | ) |
Allocate a DMXStatInfo structure.
Referenced by dmxConfigAddDisplay().
| static CARD32 dmxStatCallback | ( | OsTimerPtr | timer, | |
| CARD32 | t, | |||
| pointer | arg | |||
| ) | [static] |
References avg(), _DMXStatInfo::bins, dmxDebug, dmxLog(), dmxLogCont(), dmxNumScreens, dmxScreens, dmxStatDisplays, dmxStatInterval, _DMXStatInfo::oldSyncCount, _DMXStatInfo::pending, _DMXScreenInfo::stat, _DMXStatInfo::syncCount, and _DMXStatInfo::usec.
d30 1 a30 1Referenced by dmxStatInit().
d32 1 a32 39| void dmxStatFree | ( | DMXStatInfo * | pt | ) |
Free the memory used by a DMXStatInfo structure.
Referenced by InitOutput().
| void dmxStatInit | ( | void | ) |
Try to initialize the statistic gathering and printing routines. Initialization only takes place if dmxStatActivate has already been called. We don't need the same generation protection that we used in dmxSyncInit because our timer is always on a queue -- hence, server generation will always free it.
d34 1 a34 1References dmxStatCallback(), dmxStatInterval, and dmxStatTimer.
d36 2 a37 1Referenced by InitOutput().
d39 8 a46 6| void dmxStatSync | ( | DMXScreenInfo * | dmxScreen, | d71 4 a74 4struct timeval * | stop, | a76 1a77 5 | struct timeval * | start, | ||||||||||||||||||||||||||
| d79 2 a80 2 | unsigned long | pending | d84 2 a85 2 | ) | d87 1 d89 27 a115 3 |
| static void dmxStatValue | ( | DMXStatAvg * | data, | a201 1d203 3 a205 2 | unsigned long | value | d209 3 a211 2 | ) | [static] |
a212 14
References _DMXStatAvg::count, DMX_STAT_LENGTH, _DMXStatAvg::pos, and _DMXStatAvg::value.
Referenced by dmxStatSync().
| static unsigned long usec | ( | struct timeval * | stop, | ||||
| d215 3 a217 2 | struct timeval * | start | d221 2 a222 2 | ) | [static] |
a223 20
Return the number of microseconds as an unsigned long. Unfortunately, this is only useful for intervals < about 4 sec.
Referenced by dmxStatSync().
int dmxStatDisplays [static] |
Referenced by dmxStatActivate(), and dmxStatCallback().
| int dmxStatInterval |
OsTimerPtr dmxStatTimer [static] |
d249 14
a262 8