This is Unofficial EPICS BASE Doxygen Site
evtime.c File Reference
#include <stdio.h>
#include "dbDefs.h"
#include "epicsTime.h"
#include "cadef.h"
+ Include dependency graph for evtime.c:

Go to the source code of this file.

Macros

#define COUNT   0x8000
 

Functions

void event_handler (struct event_handler_args args)
 
int evtime (char *pname)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

#define COUNT   0x8000

Function Documentation

void event_handler ( struct event_handler_args  args)

Definition at line 73 of file evtime.c.

74 {
75  epicsUInt32 current_time;
76 # define COUNT 0x8000
77  double interval;
78  double delay;
79  epicsTimeStamp ts;
80 
81  if(iteration_count%COUNT == 0){
83  current_time = ts.secPastEpoch;
84  if(last_time != 0){
85  interval = current_time - last_time;
86  delay = interval/COUNT;
87  printf("Delay = %f sec per event\n",
88  delay);
89  }
90  last_time = current_time;
91  }
92 
93  iteration_count++;
94 }
#define printf
Definition: epicsStdio.h:41
unsigned int epicsUInt32
Definition: epicsTypes.h:43
epicsUInt32 secPastEpoch
seconds since 0000 Jan 1, 1990
Definition: epicsTime.h:34
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
#define COUNT
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
int evtime ( char *  pname)

Definition at line 42 of file evtime.c.

43 {
44  chid chan;
45  int status;
46 
47  status = ca_search(pname, &chan);
48  SEVCHK(status, NULL);
49 
50  status = ca_pend_io(10.0);
51  if(status != ECA_NORMAL){
52  printf("%s not found\n", pname);
53  return 0;
54  }
55 
56  status = ca_add_event(
57  DBR_FLOAT,
58  chan,
60  NULL,
61  NULL);
62  SEVCHK(status, __FILE__);
63 
64  status = ca_pend_event(0.0);
65  SEVCHK(status, NULL);
66 }
pvd::Status status
#define DBR_FLOAT
Definition: db_access.h:72
int epicsStdCall ca_pend_io(ca_real timeout)
Definition: access.cpp:484
#define printf
Definition: epicsStdio.h:41
#define NULL
Definition: catime.c:38
int epicsStdCall ca_pend_event(ca_real timeout)
Definition: access.cpp:457
#define ECA_NORMAL
Definition: caerr.h:77
#define SEVCHK(CA_ERROR_CODE, MESSAGE_STRING)
Definition: cadef.h:137
void event_handler(struct event_handler_args args)
Definition: evtime.c:73
#define ca_search(pChanName, pChanID)
Definition: cadef.h:859
const std::string pname
#define ca_add_event(type, chan, pFunc, pArg, pEventID)
Definition: cadef.h:866
int main ( int  argc,
char **  argv 
)

Definition at line 24 of file evtime.c.

25 {
26  char *pname;
27 
28  if(argc == 2){
29  pname = argv[1];
30  evtime(pname);
31  }
32  else{
33  printf("usage: %s <channel name>", argv[0]);
34  }
35  return(0);
36 }
#define printf
Definition: epicsStdio.h:41
int evtime(char *pname)
Definition: evtime.c:42
const std::string pname