GateProcessor::GateProcessor() { gateWaitArea = NULL; waitAreaCount = 0; fCanBeACStandGate = FALSE; m_emGateType = NoGateType; m_eLastPaxServiceTime = ElapsedTime(0L); m_eLastPaxOutConsTime = ElapsedTime(0L); }
static void QueryTimeStats (ProgTime * Start, ProgTime * invf, ProgTime * text) { if (!BooleanEnv (GetEnv ("briefstats"), 0)) { Add_Stats (S_Time, "invf", ElapsedTime (Start, invf)); Add_Stats (S_Time, "text", ElapsedTime (invf, text)); } Add_Stats (S_Time, "total", ElapsedTime (Start, text)); }
void InterestManager::UpdateLastRaycastedEntity(UserConnectionPtr conn, entity_id_t id) { std::map<entity_id_t, float>::iterator it; it = conn->syncState->lastRaycastedEntitys_.find(id); if(it == conn->syncState->lastRaycastedEntitys_.end()) conn->syncState->lastRaycastedEntitys_.insert(std::make_pair(id, ElapsedTime())); else it->second = ElapsedTime(); }
// _______________________________________________________________________________________ // void CAAudioFile::WritePacketsFromCallback( AudioConverterComplexInputDataProc inInputDataProc, void * inInputDataProcUserData) { while (true) { // keep writing until we exhaust the input (temporary stop), or produce no output (EOF) UInt32 numEncodedPackets = mIOBufferSizePackets; mIOBufferList.mBuffers[0].mDataByteSize = mIOBufferSizeBytes; #if CAAUDIOFILE_PROFILE mInConverter = true; #endif StartTiming(this, fill); OSStatus err = AudioConverterFillComplexBuffer(mConverter, inInputDataProc, inInputDataProcUserData, &numEncodedPackets, &mIOBufferList, mPacketDescs); ElapsedTime(this, fill, mTicksInConverter); #if CAAUDIOFILE_PROFILE mInConverter = false; #endif XThrowIf(err != 0 && err != kNoMoreInputRightNow, err, "convert audio packets (write)"); if (numEncodedPackets == 0) break; Byte *buf = (Byte *)mIOBufferList.mBuffers[0].mData; #if VERBOSE_IO printf("CAAudioFile::WritePacketsFromCallback: wrote %ld packets, %ld bytes\n", numEncodedPackets, mIOBufferList.mBuffers[0].mDataByteSize); if (mPacketDescs) { for (UInt32 i = 0; i < numEncodedPackets; ++i) { printf(" write packet %qd : offset %qd, length %ld\n", mPacketMark + i, mPacketDescs[i].mStartOffset, mPacketDescs[i].mDataByteSize); #if VERBOSE_IO >= 2 hexdump(buf + mPacketDescs[i].mStartOffset, mPacketDescs[i].mDataByteSize); #endif } } #endif StartTiming(this, write); XThrowIfError(AudioFileWritePackets(mAudioFile, mUseCache, mIOBufferList.mBuffers[0].mDataByteSize, mPacketDescs, mPacketMark, &numEncodedPackets, buf), "write audio file"); ElapsedTime(this, write, mTicksInIO); mPacketMark += numEncodedPackets; //mNumberPackets += numEncodedPackets; if (mFileDataFormat.mFramesPerPacket > 0) mFrameMark += numEncodedPackets * mFileDataFormat.mFramesPerPacket; else { for (UInt32 i = 0; i < numEncodedPackets; ++i) mFrameMark += mPacketDescs[i].mVariableFramesInPacket; } if (err == kNoMoreInputRightNow) break; } }
CConflictResolution::CConflictResolution() :m_nID(-1) ,m_nRadiusOfConcern(2000) ,m_enumAtIntersectionOnRight(Yes) ,m_enumFirstInATaxiway(Yes) ,m_enumOnSpecificTaxiways(No) ,m_nRunwayCrossBuffer(60) { m_pAtIntersectionOnRightList = new CAtIntersectionOnRightList(); m_pFirstInATaxiwayList = new CFirstInATaxiwayList(); m_pOnSpecificTaxiwaysList = new COnSpecificTaxiwaysList(); setRunwayAsTaxiwayApproachDistNM(10); m_tRunwayAsTaxiwayNoApporachTime = ElapsedTime(3600L); m_tRuwnayAsTaxiwayNoTakeoffTime = ElapsedTime(3600L); }
/* * ClearParking * Description: Clear the variables associated with parking status. * * Arguments: None * Return: None * * Input: None * Output: None * * Operation: reset parking_space to 0, parking_time to 0, and flags * indicating space have been updated * Call ElapsedTime() to reset elapsed_time * * Error Handling: None * * Algorithms: None * Data Strutures: None * * Shared Variables: None * * Revision History: * Apr. 23, 2013 Nnoduka Eruchalu Initial Revision */ static void ClearParking(void) { parking_space = 0; parking_time = 0; updated_space = FALSE; ElapsedTime(); }
// _______________________________________________________________________________________ // void CAAudioFile::Write(UInt32 numPackets, const AudioBufferList *data) { if (mIOBufferList.mBuffers[0].mData == NULL) { #if DEBUG printf("warning: CAAudioFile::AllocateBuffers called from WritePackets\n"); #endif AllocateBuffers(); } if (mMode == kPreparingToWrite) mMode = kWriting; else XThrowIf(mMode != kWriting, kExtAudioFileError_InvalidOperationOrder, "can't write to this file"); if (mConverter != NULL) { mWritePackets = numPackets; mWriteBufferList->SetFrom(data); WritePacketsFromCallback(WriteInputProc, this); } else { StartTiming(this, write); XThrowIfError(AudioFileWritePackets(mAudioFile, mUseCache, data->mBuffers[0].mDataByteSize, NULL, mPacketMark, &numPackets, data->mBuffers[0].mData), "write audio file"); ElapsedTime(this, write, mTicksInIO); #if VERBOSE_IO printf("CAAudioFile::WritePackets: wrote %ld packets at %qd, %ld bytes\n", numPackets, mPacketMark, data->mBuffers[0].mDataByteSize); #endif //mNumberPackets = mPacketMark += numPackets; if (mFileDataFormat.mFramesPerPacket > 0) mFrameMark += numPackets * mFileDataFormat.mFramesPerPacket; // else: shouldn't happen since we're only called when there's no converter } }
ElapsedTime AirspaceTrafficController::GetInTrailSeperationTime( FlightInAirsideSimulation* pLeadFlight, FlightInAirsideSimulation* pTrailFlight, FlightMode mode ) { CString ACTypeLead; CString ACTypeTrail; if(pLeadFlight){ pLeadFlight->GetCFlight()->getACType(ACTypeLead.GetBuffer(255)); } if(pTrailFlight){ pTrailFlight->GetCFlight()->getACType(ACTypeTrail.GetBuffer(255)); } DistanceUnit sepDist; ElapsedTime sepTime; if(mode == OnCruiseThrough || mode == OnCruiseArr || mode == OnCruiseDep ) // Cruise { sepDist = m_pSeparationManager->GetCruiseInTrailSeparationDist(ACTypeLead,ACTypeTrail); sepTime = m_pSeparationManager->GetCruiseInTrailSeparationTime(ACTypeLead,ACTypeTrail); } if(mode == OnTerminal) { sepDist = m_pSeparationManager->GetTerminalInTrailSeparationDist(ACTypeLead,ACTypeTrail); sepTime = m_pSeparationManager->GetTerminalInTrailSeparationTime(ACTypeLead,ACTypeTrail); } if(mode == OnApproach) { sepDist = m_pSeparationManager->GetApproachInTrailSeparationDist(ACTypeLead,ACTypeTrail); sepTime = m_pSeparationManager->GetApproachInTrailSeparationTime(ACTypeLead,ACTypeTrail); } if(mode == OnFinalApproach) { sepDist = m_pSeparationManager->GetApproachInTrailSeparationDist(ACTypeLead,ACTypeTrail); sepTime = m_pSeparationManager->GetApproachInTrailSeparationTime(ACTypeLead,ACTypeTrail); } return max( sepTime, ElapsedTime(sepDist/pTrailFlight->GetFlightState().m_vSpeed) ); }
/* if Departure flight need delay, the time while arrive at stand will be delay, and, departure time will be delay also. Flight's boarding call time need delay. -----Arrival at Stand(10:30)--------Boarding Call(10:40, 10:45, 10:50,) --Departure(11:00)- (Gate Time: 00:30) delay: 30 min: (Departure Flight)-----Arrival at Stand(11:00)----------Boarding Call(11:10, 11:15, 11:20,) --Departure(11:30)- (Turnaround Flight)-----Arrival at Stand(10:00 + arr delay time)----------Boarding Call(11:10, 11:15, 11:20,) --Departure(11:30)- */ void FlightDelaysUtility::impactFlightDelaysEffectToBoardingCall(FlightsBoardingCallManager* _pBoardingcallMgr, const FlightSchedule* pSchedule) { int numFlights = pSchedule->getCount(); for (int nFltIndex = 0; nFltIndex < numFlights; nFltIndex++) { Flight* pItem = pSchedule->getItem(nFltIndex); if(pItem->isDeparting())// departure or turnaround. { ElapsedTime depDelayTime = pItem->getDepDelay(); if(depDelayTime < ElapsedTime(0L) )// departure flight cannot departure earlier(according to schedule). continue; FlightItemBoardingCallMgr* pFltBoardingMgr = _pBoardingcallMgr->GetFlightItemBoardingCallMgr( pItem ); //ASSERT(pFltBoardingMgr != NULL ); if( NULL != pFltBoardingMgr ) pFltBoardingMgr->delayEvents( depDelayTime ); std::map<int,ElapsedTime>&mapLastCalls = pItem->GetLastCallOfEveryStage(); std::map<int,ElapsedTime>::iterator iter = mapLastCalls.begin(); for (; iter != mapLastCalls.end(); ++iter) { iter->second += depDelayTime; } } } }
void ArrivalPaxLandsideBehavior::ProcessPickCarryOnFromVehicle( const ElapsedTime& eEventTime ) { //pick up carry ons // move to destination LandsideResourceInSim *pDestResource = NULL; LandsideVehicleInSim* pVehicle = m_pPerson->getEngine()->GetLandsideSimulation()->FindPaxVehicle(m_pPerson->getID()); if(pVehicle) { setVehicle(pVehicle); pDestResource = pVehicle->getLastState().getLandsideRes(); } if(pDestResource == NULL) { ASSERT(FALSE); terminate(eEventTime); return; } //destination is parking lot setDestResource(pDestResource); setState(MoveToFacility); GenerateEvent(eEventTime + ElapsedTime(2L)); }
bool CBagCartsParkingSpotInSim::GetEnterParkSpotClearance( AirsideVehicleInSim * pVehicleInSim, ClearanceItem& lastItem ) { CPoint2008 pLocation = lastItem.GetPosition(); CPath2008 subPath; DistancePointPath3D distPtPath; if (distPtPath.GetSquared(pLocation,m_leadinPath) > 10.0) { subPath = m_leadinPath; subPath.insertPointBeforeAt(pLocation,0); double dLength = subPath.GetTotalLength(); subPath = subPath.GetSubPath(0,dLength - pVehicleInSim->GetLength() *0.5); } else { double dDist = m_leadinPath.GetPointDist(pLocation); double dLength = m_leadinPath.GetTotalLength(); subPath = m_leadinPath.GetSubPath(dDist,dLength - pVehicleInSim->GetLength() *0.5); } DistanceUnit distOfPath = subPath.GetTotalLength(); double avgSpd = pVehicleInSim->GetSpeed() * 0.5; ElapsedTime dT = ElapsedTime(distOfPath/avgSpd); ElapsedTime endTime = lastItem.GetTime() + dT; pVehicleInSim->SetMode(OnMoveInBagTrainSpot); WriteVehiclePathLog(pVehicleInSim,subPath,lastItem.GetTime(),pVehicleInSim->GetSpeed(),endTime,0.0,false); return true; }
bool CBagCartsParkingSpotInSim::GetExitParkSpotClearance( AirsideVehicleInSim * pVehicleInSim, const ElapsedTime& tTime,const CPoint2008& ptLocation ) { CPath2008 subPath; DistancePointPath3D distPtPath; if (distPtPath.GetSquared(ptLocation,m_leadoutPath) > 10.0) { subPath = m_leadoutPath; subPath.insertPointAfterAt(ptLocation,subPath.getCount() - 1); } else { double dDist = m_leadoutPath.GetPointDist(ptLocation); subPath = m_leadoutPath.GetSubPath(0,dDist); } DistanceUnit distOfPath = subPath.GetTotalLength(); double avgSpd = pVehicleInSim->GetOnRouteSpeed() * 0.5; ElapsedTime dT = ElapsedTime(distOfPath/avgSpd); ElapsedTime endTime = tTime + dT; WriteVehiclePathLog(pVehicleInSim,subPath,tTime,0.0,endTime,pVehicleInSim->GetOnRouteSpeed(),m_pBagCartsSpotInput->IsPushBack()); return true; }
void CBagCartsParkingSpotInSim::WriteVehiclePathLog( AirsideVehicleInSim * pVehicleInSim,const CPath2008& path,const ElapsedTime& startTime, double startSpeed, const ElapsedTime& endTime,double endSpd,BOOL bPushBack ) { DistanceUnit DDist = path.GetTotalLength(); ElapsedTime DT = endTime - startTime; if(DDist > 0 &&( startSpeed + endSpd ) >0) { for (int i = 0; i < path.getCount(); i++) { DistanceUnit realDist = path.GetIndexDist((float)i); double b = realDist / DDist; double r; r = b; CPoint2008 pPosition = path.getPoint(i); double dSpeed = startSpeed * (1.0-r) + endSpd * r; ElapsedTime dT = ElapsedTime ((double)DT * r); ElapsedTime tTime = startTime + dT; pVehicleInSim->SetPosition(pPosition); pVehicleInSim->SetTime(tTime); pVehicleInSim->SetSpeed(dSpeed); pVehicleInSim->WirteLog(pPosition,dSpeed,tTime,bPushBack?true:false); } } }
/*-------------------------------------------------------------------------*/ int SlpPerfTest1_slpreg (SLPHandle hslp, SLPList* service_list, double* ave_slpreg, int* count_slpreg) /*-------------------------------------------------------------------------*/ { struct timezone tz; struct timeval start; struct timeval end; TestService_T* srv; SLPError errorcode; srv = CreateRandomTestService(*count_slpreg); if(srv == 0) { return ENOMEM; } /* mark start time */ gettimeofday(&start,&tz); /* call SLP API */ errorcode = SLPReg(hslp, srv->serviceurl, SLP_LIFETIME_MAXIMUM - 1, srv->servicetype, srv->attributes, SLP_TRUE, SlpPerfTest1_regreport, srv); if(errorcode != SLP_OK) { printf("SLPReg(hslp,%s,SLP_LIFETIME_MAX,%s,%s,SLP_FALSE,callback,0) returned %i\n", srv->serviceurl, srv->servicetype, srv->attributes, errorcode); printf("This should not happen!\n"); return -1; } /* mark end time */ gettimeofday(&end,&tz); /* link the registered service into the list */ SLPListLinkHead(service_list,(SLPListItem*)srv); /* recalculate average time */ *ave_slpreg = (*ave_slpreg) * (*count_slpreg) + ElapsedTime(&start,&end); *count_slpreg = *count_slpreg + 1; *ave_slpreg = *ave_slpreg / *count_slpreg; return 0; }
void CRunwayDetailExitResult::Draw3DChart(CARC3DChart& chartWnd, CParameters *pParameter) { if(pParameter == NULL) return ; C2DChartData c2dGraphData; c2dGraphData.m_strChartTitle.Format(_T("Runway Exit Detail Delay")) ; c2dGraphData.m_strYtitle = _T("Number of aircrafts"); c2dGraphData.m_strXtitle = _T("Date and time") ; //set footer CString strFooter(_T("")); strFooter.Format(_T("%s %s,%s "),_T("Runway Exit Detail Delay"), pParameter->getStartTime().printTime(), pParameter->getEndTime().printTime()); bool bCommaFlag = true; c2dGraphData.m_strFooter = strFooter; int intervalSize = 0 ; ElapsedTime IntervalTime ; IntervalTime = (pParameter->getEndTime() - pParameter->getStartTime()) ; intervalSize = IntervalTime.asSeconds() / pParameter->getInterval() ; CTimeIntervalFlightData* PTimeIntervalData = NULL ; IntervalTime = pParameter->getStartTime() ; CString timeInterval ; ElapsedTime startTime = pParameter->getStartTime(); ElapsedTime endtime ; for (int i = 0 ; i < intervalSize ;i++) { endtime = startTime + ElapsedTime(pParameter->getInterval()) ; timeInterval.Format(_T("%s-%s"),startTime.printTime(),endtime.printTime()) ; startTime = endtime ; c2dGraphData.m_vrXTickTitle.push_back(timeInterval) ; } CRunwayExitRepDataItem* RunwayExitRepDataItem = NULL ; CString Strval ; int size = (int)( m_ReportBaseData->GetData()->size() ); for (int i = 0 ; i < size; i++) { RunwayExitRepDataItem = m_ReportBaseData->GetData()->at(i) ; Strval.Format(_T("%s %s"),RunwayExitRepDataItem->m_RunwayName,RunwayExitRepDataItem->m_RunwayExitName) ; c2dGraphData.m_vrLegend.push_back(Strval); std::vector<double> segmentData ; CTimeIntervalFlightData* TimerIntervalData = NULL ; for (int j = 0 ; j < (int)RunwayExitRepDataItem->GetData()->size() ;j++) { TimerIntervalData = RunwayExitRepDataItem->GetData()->at(j) ; segmentData.push_back((long)TimerIntervalData->m_FlightData.size()) ; } c2dGraphData.m_vr2DChartData.push_back(segmentData); } chartWnd.DrawChart(c2dGraphData); }
void XWindow::update(void) { //Updating Time Now(getSystemTime()); Time ElapsedTime(Now - getLastUpdateTime()); if(ElapsedTime > 0.0 && ElapsedTime < 10.0) { produceUpdate(ElapsedTime); } setLastUpdateTime(Now); }
void TimerProbe::print(const timespec& r, const timespec& p, const timespec& t) const { uint32_t es = ElapsedTime(gRealBase, mRealStart); uint32_t er = ElapsedTime(mRealStart, r); uint32_t ep = ElapsedTime(mPStart, p); uint32_t et = ElapsedTime(mTStart, t); if (mIndent > 0) { Bucket& bucket = gBuckets.editItemAt(mBucket); if (bucket.mStart == 0) bucket.mStart = es; bucket.mReal += er; bucket.mProcess += ep; bucket.mThread += et; bucket.mCount++; return; } int index = 0; int buckets = gBuckets.size(); int count = 1; const char* tag = mTag; int indent = mIndent; do { LOGD("%-30.30s: (%3d) %-5.*s time=%-10.3f real=%7dus process=%7dus (%3d%%) thread=%7dus (%3d%%)\n", tag, count, indent > 5 ? 5 : indent, "+++++", es / 1000000.0, er, ep, ep * 100 / er, et, et * 100 / er); if (index >= buckets) break; Bucket& bucket = gBuckets.editItemAt(index); count = bucket.mCount; es = bucket.mStart; er = bucket.mReal; ep = bucket.mProcess; et = bucket.mThread; tag = bucket.mTag; indent = bucket.mIndent; *bucket.mSlotPtr = 0; } while (++index); // always true gBuckets.clear(); }
void QueryContinuously(HANDLE hProcess) { Sleep(2000); // give the process some time to launch bool pastDuration = false; time_t startTime = time(NULL); unsigned int memUsage = evalProcesses(hProcess); while(memUsage && !pastDuration) { printf( "%u\n", memUsage ); Sleep(gQueryInterval*1000); memUsage = evalProcesses(hProcess); pastDuration = gDuration > 0 ? ElapsedTime(startTime) > gDuration : false; } }
void ArrivalPaxLandsideBehavior::ProcessPutCarryonToVehicle( const ElapsedTime& eEventTime ) { ElapsedTime serviceT = ElapsedTime(0L); LandsideResourceInSim* pRes = getResource(); LandsideVehicleInSim* pV = getVehicle(); if(pRes && pV) { serviceT = pRes->getLayoutObject()->GetServiceTime(pV->getName()); } ElapsedTime nextT = eEventTime+serviceT; WriteLogEntry(nextT); ////go to the parking //ARCVector3 bagPos = m_pVehicle->getLastState().pos; //setDestination(bagPos); //ElapsedTime dNextTime = eEventTime; //dNextTime += moveTime(); ////setLocation(bagPos); //WriteLogEntry(dNextTime); ////write bag log //Passenger* pPassenger = (Passenger*)m_pPerson; //int nCount = pPassenger->m_pVisitorList.size(); //for( int i=nCount-1; i>=0; i-- ) //{ // PaxVisitor* pVis = pPassenger->m_pVisitorList[i]; // if (pVis == NULL) // continue; // VisitorLandsideBehavior* pCarryonBehavior = (VisitorLandsideBehavior*)pVis->getLandsideBehavior(); // ASSERT(pCarryonBehavior); // //non passenger move to ground // if(pCarryonBehavior) // { // pCarryonBehavior->setDestination(bagPos); // ElapsedTime eMoveTime = moveTime(); // ElapsedTime eCurTime = dNextTime + eMoveTime; // pCarryonBehavior->setLocation( bagPos); // pCarryonBehavior->WriteLogEntry(eCurTime, i); // } // //detach to passenger // pPassenger->m_pVisitorList[i] = NULL; //} setState(GetOnVehicle); GenerateEvent(nextT); }
BStopWatch::~BStopWatch() { if (!fSilent){ printf("StopWatch \"%s\": %d usecs.\n", fName, (int)ElapsedTime()); if (fLap) { for (int i = 1; i <= fLap; i++){ if (!((i-1)%4)) printf("\n "); printf("[%d: %d#%d] ", i, (int)(fLaps[i]-fStart), (int)(fLaps[i] - fLaps[i -1 ])); } printf("\n"); } } }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + S t o p T i m e r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % StopTimer() stops the stopwatch. % % The format of the StopTimer method is: % % void StopTimer(TimerInfo *time_info) % % A description of each parameter follows. % % o time_info: Timer statistics structure. % */ static void StopTimer(TimerInfo *time_info) { assert(time_info != (TimerInfo *) NULL); assert(time_info->signature == MagickSignature); time_info->elapsed.stop=ElapsedTime(); time_info->user.stop=UserTime(); if (time_info->state == RunningTimerState) { time_info->user.total+=time_info->user.stop- time_info->user.start+MagickEpsilon; time_info->elapsed.total+=time_info->elapsed.stop- time_info->elapsed.start+MagickEpsilon; } time_info->state=StoppedTimerState; }
void CheckForTimeout(int score, int globalscore, int Jscore, int zwndw) { if (flag.musttimeout || (Sdepth >= MaxSearchDepth)) flag.timeout = true; else if (TCflag && (Sdepth > (MINDEPTH - 1)) && (TCcount < MAXTCCOUNTR)) { if (killr0[1] != PrVar[1] /* || Killr0[2] != PrVar[2] */) { TCcount++; ExtraTime += TCleft; } if ((TCcount < MAXTCCOUNTR) && (abs(score - globalscore) / Sdepth) > ZDELTA) { TCcount++; ExtraTime += TCleft; } } if ((score > (Jscore - zwndw)) && (score > (Tree[1].score + 250))) ExtraTime = 0; ElapsedTime(COMPUTE_MODE); if (root->flags & exact) flag.timeout = true; /*else if (Tree[1].score < -SCORE_LIMIT) flag.timeout = true; */ #if defined OLDTIME || !defined HAVE_GETTIMEOFDAY else if (!(Sdepth < MINDEPTH) && TCflag && ((4 * et) > (2*ResponseTime + ExtraTime))) flag.timeout = true; #else else if (!(Sdepth < MINDEPTH) && TCflag && ((int)(1.93913099l * (pow((double)et, 1.12446928l))) > (ResponseTime + ExtraTime))) flag.timeout = true; #endif if (flag.timeout) ShowMessage("timeout"); }
/*-------------------------------------------------------------------------*/ int SlpPerfTest1_slpdereg (SLPHandle hslp, SLPList* service_list, double* ave_slpdereg, int* count_slpdereg) /*-------------------------------------------------------------------------*/ { struct timezone tz; struct timeval start; struct timeval end; TestService_T* srv; SLPError errorcode; srv = FindRandomTestService(service_list); /* mark start time */ gettimeofday(&start,&tz); /* call SLP API */ errorcode = SLPDereg(hslp, srv->serviceurl, SlpPerfTest1_deregreport, srv); if(errorcode != SLP_OK) { printf("SLPDereg(hslp,%s,callback,0) returned %i\n", srv->serviceurl, errorcode); printf("This should not happen!\n"); return -1; } /* mark end time */ gettimeofday(&end,&tz); /* unlink the registered service from the list and free it*/ free(SLPListUnlink(service_list,(SLPListItem*)srv)); /* recalculate average time */ *ave_slpdereg = (*ave_slpdereg) * (*count_slpdereg) + ElapsedTime(&start,&end); *count_slpdereg = *count_slpdereg + 1; *ave_slpdereg = *ave_slpdereg / *count_slpdereg; return 0; }
ElapsedTime HeadingAirRouteSegInSim::GetMaxTimeInSegment(AirsideFlightInSim* pFlight, double dSped1, double dSped2, AirsideResource* pNextRes) { double dDist = m_WPExtentPoint.distance(m_pFirstIntersection->getInputPoint()->GetPosition()) ; if (m_HeadingType == Direct) { dDist += m_WPExtentPoint.distance(m_pFirstIntersection->getInputPoint()->GetPosition()); } else { CPoint2008 extentPoint = GetProjectionPosition(m_WPExtentPoint, pNextRes,pFlight); dDist += extentPoint.distance(m_WPExtentPoint); dDist += extentPoint.distance(m_pSecondIntersection->getInputPoint()->GetPosition()); } return ElapsedTime(2.0*dDist/(dSped1+dSped2)); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + S t a r t T i m e r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % StartTimer() starts the stopwatch. % % The format of the StartTimer method is: % % void StartTimer(TimerInfo *time_info,const MagickBooleanType reset) % % A description of each parameter follows. % % o time_info: Timer statistics structure. % % o reset: If reset is MagickTrue, then the stopwatch is reset prior to % starting. If reset is MagickFalse, then timing is continued without % resetting the stopwatch. % */ MagickExport void StartTimer(TimerInfo *time_info,const MagickBooleanType reset) { assert(time_info != (TimerInfo *) NULL); assert(time_info->signature == MagickSignature); if (reset != MagickFalse) { /* Reset the stopwatch before starting it. */ time_info->user.total=0.0; time_info->elapsed.total=0.0; } if (time_info->state != RunningTimerState) { time_info->elapsed.start=ElapsedTime(); time_info->user.start=UserTime(); } time_info->state=RunningTimerState; }
void AirsideFollowMeCarInSim::_ChangeToService() { CPoint2008 waitingPos = m_pMeetingPoint->GetWaitingPosition(); ElapsedTime tTime = ElapsedTime(2.0*waitingPos.distance(GetPosition())/GetSpeed()) + GetTime(); SetMode(OnWaitForService); SetTime(tTime); SetPosition(waitingPos); if (m_pServiceFlight->GetMode() == OnTaxiToStand) { m_pServiceFlight->SetBeginFollowMeCarService(); WirteLog(waitingPos,GetSpeed(),tTime); ServicingFlight(); } else { SetSpeed(0); WirteLog(waitingPos,GetSpeed(),tTime); } }
/* * UpdatePark * Description: write in parking space and time left * * Arguments: curr_state - the current system state * Return: nextstate - the next system state * * Input: None * Output: None * * Operation: if there is an updated parking space, show it on the * parking page. * Then reset the updated_space flag to FALSE, since * the update has been handled. * display new parking time if time has elapsed * * Error Handling: None * * Algorithms: None * Data Strutures: None * * Shared Variables: None * * Revision History: * Apr. 26, 2013 Nnoduka Eruchalu Initial Revision */ state UpdatePark(state curr_state) { int32_t old_parking_time = parking_time; if (updated_space) { LcdCursor(0,12); LcdWriteInt(parking_space); /* write space number */ updated_space = FALSE; } /* always update the displayed time */ parking_time -= ElapsedTime(); /* get elapsed seconds */ if (parking_time < 0) /* but keep time */ parking_time = 0; /* non-negative */ /* if time has changed, update it in seconds */ if (parking_time/TIME_SCALE != old_parking_time/TIME_SCALE) DisplayTime(1,12,parking_time/TIME_SCALE, DISPLAYTIME_SECS); /* update it (in secs) */ return curr_state; }
int main (int argc, char **argv) { ProgTime StartTime; int ch; opterr = 0; msg_prefix = argv[0]; while ((ch = getopt (argc, argv, "f:d:b:sh")) != -1) switch (ch) { case 'f': /* input file */ file_name = optarg; break; case 'd': set_basepath (optarg); break; case 'b': bits = atoi (optarg); if (bits > 32) { fprintf (stderr, "b may only take values 0-32\n"); exit (1); } break; case 'h': case '?': fprintf (stderr, "usage: %s [-f input_file]" "[-d data directory] [-b bits] [-s] [-h]\n", argv[0]); exit (1); } GetTime (&StartTime); GenerateWeights (); Make_weight_approx (); Make_text_idx_wgt (); Message ("%s", ElapsedTime (&StartTime, NULL)); exit (0); }
/** * CalStatusReadyCheck * Check whether status is ready or not. */ bool cs5463spi::CalStatusReadyCheck(long long maxElapsedTime){ struct timespec startTime; long long elapsedTime = 0; bool bCalStatusRdy = false; startTime = this->CurrentTime(); do{ elapsedTime = ElapsedTime(startTime); bCalStatusRdy = CheckStatusReady(drdy); }while(!bCalStatusRdy && elapsedTime < maxElapsedTime); cout << "Elapsed Time: " << (elapsedTime/1E9) << endl; if(bCalStatusRdy) cout << "Status: " << m_statusWarn[drdy].c_str() << endl; else cout << "Status: " << m_statusWarn[drdy].c_str() << " NOT" << endl; return bCalStatusRdy; }
/*virtual*/ void Application::ThreadDynamicSleep() { float elapsedTime = ElapsedTime(); if (boost::algorithm::clamp(elapsedTime - mOldElapsedTime,0.0001f,1.0f) < 1.0f / mDesiredFramerate) { mDynamicSleepSecs += 0.001f; } else { mDynamicSleepSecs = std::max(0.0f,mDynamicSleepSecs - 0.001f); } mOldElapsedTime = elapsedTime; if (mDynamicSleepSecs > 0.0f) { ThreadSleep(mDynamicSleepSecs); } }