//@C Copyright Notice //@C ================ //@C This file is part of CPSW. It is subject to the license terms in the LICENSE.txt //@C file found in the top-level directory of this distribution and at //@C https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. //@C //@C No part of CPSW, including this file, may be copied, modified, propagated, or //@C distributed except according to the terms contained in the LICENSE.txt file. #include RssiTimer::RssiTimer( const char *name, RssiTimerList *lh, uint64_t exp) : next_( NULL ), prev_( NULL ), lh_ ( lh ), exp_ ( exp ), name_( name ) { } uint64_t RssiTimer::overdue() { struct timespec nowts; uint64_t diffUs; if ( !next_ && !prev_ ) { /* inactive */ return 0; } clock_gettime( CLOCK_REALTIME, &nowts ); CTimeout now( nowts ); if ( exp_ < now ) { now -= exp_; diffUs = now.getUs(); } else { diffUs = 0; } return diffUs; } void RssiTimer::process() { uint64_t diffUs = overdue(); if ( diffUs > 10000 ) { fprintf(stderr, "Timeout (%s) missed by more than 10ms: %lld\n", name_, (unsigned long long)diffUs); } }