24 unsigned *pCount = static_cast <
unsigned * > ( args.
usr );
33 static const double initialSamplePeriod = 1.0;
34 static const double maxSamplePeriod = 60.0 * 5.0;
35 unsigned eventCount = 0u;
40 printf (
"Connecting to CA Channel \"%s\" %u times.",
44 epicsTime
begin = epicsTime::getCurrent ();
45 for (
unsigned i = 0u;
i <
count;
i++ ) {
52 fprintf (
stderr,
" not found.\n" );
55 epicsTime end = epicsTime::getCurrent ();
57 printf (
" done(%f sec).\n", end - begin );
61 printf (
"Subscribing %u times.", count );
64 epicsTime
begin = epicsTime::getCurrent ();
65 for (
unsigned i = 0u;
i <
count;
i++ ) {
68 SEVCHK ( addEventStatus, __FILE__ );
72 SEVCHK ( status, __FILE__ );
74 epicsTime end = epicsTime::getCurrent ();
76 printf (
" done(%f sec).\n", end - begin );
80 printf (
"Waiting for initial value events." );
84 epicsTime
begin = epicsTime::getCurrent ();
85 while ( eventCount < count ) {
91 epicsTime end = epicsTime::getCurrent ();
93 printf (
" done(%f sec).\n", end - begin );
96 double samplePeriod = initialSamplePeriod;
101 unsigned nEvents, lastEventCount, curEventCount;
103 epicsTime beginPend = epicsTime::getCurrent ();
104 lastEventCount = eventCount;
106 curEventCount = eventCount;
107 epicsTime endPend = epicsTime::getCurrent ();
112 if ( curEventCount >= lastEventCount ) {
113 nEvents = curEventCount - lastEventCount;
116 nEvents = ( UINT_MAX - lastEventCount ) + curEventCount + 1u;
121 double period = endPend - beginPend;
122 double Hz = nEvents / period;
128 double stdDev = sqrt ( XX / N - mean * mean );
130 printf (
"CA Event Rate (Hz): current %g mean %g std dev %g\n",
133 if ( samplePeriod < maxSamplePeriod ) {
134 samplePeriod += samplePeriod;
void exception epicsGuard< epicsMutex > int const char const char unsigned oldChannelNotify unsigned arrayElementCount count
int epicsStdCall ca_pend_io(ca_real timeout)
Miscellaneous macro definitions.
int epicsStdCall ca_pend_event(ca_real timeout)
int epicsStdCall ca_flush_io()
#define SEVCHK(CA_ERROR_CODE, MESSAGE_STRING)
void eventCallBack(struct event_handler_args args)
#define ca_search(pChanName, pChanID)
void caEventRate(const char *pName, unsigned count)
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
#define ca_add_event(type, chan, pFunc, pArg, pEventID)