replace osiClock calls by tsStamp calls

This commit is contained in:
Marty Kraimer
2000-01-04 21:53:05 +00:00
parent 20196ff502
commit 692b571e01
5 changed files with 32 additions and 28 deletions

View File

@@ -30,6 +30,7 @@ static char *sccsId = "@(#) $Id$";
*/
#define CAC_VERSION_GLOBAL
#include "tsStamp.h"
#include "iocinf.h"
#include "sigPipeIgnore.h"
@@ -2677,7 +2678,7 @@ void cac_gettimeval(struct timeval *pt)
TS_STAMP ts;
int status;
clockGetCurrentTime(&ts);
tsStampGetCurrent(&ts);
pt->tv_sec = ts.secPastEpoch;
pt->tv_usec = ts.nsec/1000;
}

View File

@@ -18,6 +18,7 @@ static char *sccsId = "@(#) $Id$";
* EPICS
*/
#include "epicsAssert.h"
#include "tsStamp.h"
/*
* CA
@@ -933,14 +934,14 @@ int acctst(char *pname)
dbr_double_t request = 15.0;
dbr_double_t accuracy;
tsLocalTime(&start_time);
tsStampGetCurrent(&start_time);
printf("waiting for events for %f sec\n", request);
status = ca_pend_event(request);
if (status != ECA_TIMEOUT) {
SEVCHK(status, NULL);
}
tsLocalTime(&end_time);
TsDiffAsDouble(&delay,&end_time,&start_time);
tsStampGetCurrent(&end_time);
delay = tsStampDiffInSeconds(&end_time,&start_time);
accuracy = 100.0*(delay-request)/request;
printf("CA pend event delay accuracy = %f %%\n",
accuracy);
@@ -951,12 +952,12 @@ int acctst(char *pname)
TS_STAMP start_time;
dbr_double_t delay;
tsLocalTime(&start_time);
tsStampGetCurrent(&start_time);
printf("entering ca_task_exit()\n");
status = ca_task_exit();
SEVCHK(status,NULL);
tsLocalTime(&end_time);
TsDiffAsDouble(&delay,&end_time,&start_time);
tsStampGetCurrent(&end_time);
delay = tsStampDiffInSeconds(&end_time,&start_time);
printf("in ca_task_exit() for %f sec\n", delay);
}
@@ -997,13 +998,13 @@ void pend_event_delay_test(dbr_double_t request)
dbr_double_t delay;
dbr_double_t accuracy;
tsLocalTime(&start_time);
tsStampGetCurrent(&start_time);
status = ca_pend_event(request);
if (status != ECA_TIMEOUT) {
SEVCHK(status, NULL);
}
tsLocalTime(&end_time);
TsDiffAsDouble(&delay,&end_time,&start_time);
tsStampGetCurrent(&end_time);
delay = tsStampDiffInSeconds(&end_time,&start_time);
accuracy = 100.0*(delay-request)/request;
printf("CA pend event delay = %f sec results in error = %f %%\n",
request, accuracy);

View File

@@ -19,6 +19,7 @@
#include "epicsAssert.h"
#include "cadef.h"
#include "caProto.h"
#include "tsStamp.h"
#ifndef LOCAL
#define LOCAL static
@@ -266,16 +267,16 @@ void timeIt(
unsigned inlineIter;
unsigned nBytes;
status = tsLocalTime(&start_time);
status = tsStampGetCurrent(&start_time);
#if 0
assert (status == S_ts_OK);
#endif
(*pfunc) (pItems, iterations, &inlineIter);
status = tsLocalTime(&end_time);
status = tsStampGetCurrent(&end_time);
#if 0
assert (status == S_ts_OK);
#endif
TsDiffAsDouble(&delay,&end_time,&start_time);
delay = tsStampDiffInSeconds(&end_time,&start_time);
if (delay>0.0) {
printf ("Elapsed Per Item = %12.8f sec, %10.1f Items per sec",
delay/(iterations*inlineIter),
@@ -621,16 +622,16 @@ LOCAL void measure_get_latency (ti *pItems, unsigned iterations)
int status;
for (pi=pItems; pi<&pItems[iterations]; pi++) {
tsLocalTime (&start_time);
tsStampGetCurrent (&start_time);
status = ca_array_get (pi->type, pi->count,
pi->chix, &pi->val);
SEVCHK (status, NULL);
status = ca_pend_io (100.0);
SEVCHK (status, NULL);
tsLocalTime(&end_time);
tsStampGetCurrent(&end_time);
TsDiffAsDouble(&delay,&end_time,&start_time);
delay = tsStampDiffInSeconds(&end_time,&start_time);
X += delay;
XX += delay*delay;

View File

@@ -2,14 +2,13 @@
#include <stdio.h>
#include "cadef.h"
#include "dbDefs.h"
#include "osiClock.h"
#include "tsStamp.h"
void event_handler(struct event_handler_args args);
int evtime(char *pname);
static unsigned iteration_count;
static unsigned last_time;
static double rate;
static epicsUInt32 last_time;
#ifndef iocCore
int main(int argc, char **argv)
@@ -44,8 +43,6 @@ int evtime(char *pname)
return OK;
}
rate = clockGetRate();
status = ca_add_event(
DBR_FLOAT,
chan,
@@ -65,19 +62,20 @@ int evtime(char *pname)
*/
void event_handler(struct event_handler_args args)
{
unsigned current_time;
epicsUInt32 current_time;
# define COUNT 0x8000
double interval;
double delay;
TS_STAMP ts;
if(iteration_count%COUNT == 0){
current_time = clockGetCurrentTick();
tsStampGetCurrent(&ts);
current_time = ts.secPastEpoch;
if(last_time != 0){
interval = current_time - last_time;
delay = interval/(rate*COUNT);
printf("Delay = %f sec for 1 event\n",
delay,
COUNT);
delay = interval/COUNT;
printf("Delay = %f sec per event\n",
delay);
}
last_time = current_time;
}

View File

@@ -33,6 +33,9 @@
/*
* $Log$
* Revision 1.82 2000/01/04 17:09:34 mrk
* dont include osiTime.h
*
* Revision 1.81 1999/11/18 16:15:42 mrk
* changes for iocCore port
*
@@ -220,7 +223,7 @@ HDRVERSIONID(iocinfh, "$Id$")
#include "ellLib.h"
#include "envDefs.h"
#include "epicsPrint.h"
#include "tsDefs.h"
#include "tsStamp.h"
#if defined(epicsExportSharedSymbols)
#error suspect that libCom was not imported