/* timeFunction.cpp */ /** * Copyright - See the COPYRIGHT that is included with this distribution. * EPICS pvDataCPP is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ #include #include #include #include namespace epics { namespace pvData { TimeFunction::TimeFunction(TimeFunctionRequester *requester) : requester(requester) {} TimeFunction::~TimeFunction() {} double TimeFunction::timeCall() { TimeStamp startTime; TimeStamp endTime; double perCall = 0.0; long ntimes = 1; while(true) { startTime.getCurrent(); for(long i=0; ifunction(); endTime.getCurrent(); double diff = TimeStamp::diff(endTime,startTime); if(diff>=1.0) { perCall = diff/(double)ntimes; break; } ntimes *= 2; } return perCall; } }}