static void DAQ_Accumulate (void) { int i; const DAQ_Stats_t* ps = DAQ_GetStats(); tot_stats.hw_packets_received += ps->hw_packets_received; tot_stats.hw_packets_dropped += ps->hw_packets_dropped; tot_stats.packets_received += ps->packets_received; tot_stats.packets_filtered += ps->packets_filtered; tot_stats.packets_injected += ps->packets_injected; for ( i = 0; i < MAX_DAQ_VERDICT; i++ ) tot_stats.verdicts[i] += ps->verdicts[i]; }
static double GetPacketDropPortion() { uint64_t drop, recv, sum; double portion; const DAQ_Stats_t* ps = DAQ_GetStats(); /* Debugging code: DAQ_Stats_t test_stats; test_stats.packets_received = 2000; test_stats.hw_packets_dropped = 1050; ps = &test_stats; */ recv = ps->packets_received; drop = ps->hw_packets_dropped; sum = recv + drop; if( sum == 0 ) portion = 0.0; else portion = ((double)drop / (double)sum); return( portion ); }