示例#1
0
/**
 * \brief Print some stats to the log at program exit.
 *
 * \param tv Pointer to ThreadVars.
 * \param data Pointer to data, ErfFileThreadVars.
 */
void
ReceiveErfDagThreadExitStats(ThreadVars *tv, void *data)
{
    ErfDagThreadVars *ewtn = (ErfDagThreadVars *)data;

    SCLogInfo("Stream: %d; Bytes: %"PRIu64"; Packets: %"PRIu64
              "; Drops: %"PRIu64,
              ewtn->dagstream,
              ewtn->bytes,
              (uint64_t)SCPerfGetLocalCounterValue(ewtn->packets, tv->sc_perf_pca),
              (uint64_t)SCPerfGetLocalCounterValue(ewtn->drops, tv->sc_perf_pca));
}
示例#2
0
static inline void PfringDumpCounters(PfringThreadVars *ptv)
{
    pfring_stat pfring_s;
    if (likely((pfring_stats(ptv->pd, &pfring_s) >= 0))) {
        /* pfring counter is per socket and is not cleared after read.
         * So to get the number of packet on the interface we can add
         * the newly seen packets and drops for this thread and add it
         * to the interface counter */
        uint64_t th_pkts = SCPerfGetLocalCounterValue(ptv->capture_kernel_packets,
                                                      ptv->tv->sc_perf_pca);
        uint64_t th_drops = SCPerfGetLocalCounterValue(ptv->capture_kernel_drops,
                                                       ptv->tv->sc_perf_pca);
        SC_ATOMIC_ADD(ptv->livedev->pkts, pfring_s.recv - th_pkts);
        SC_ATOMIC_ADD(ptv->livedev->drop, pfring_s.drop - th_drops);
        SCPerfCounterSetUI64(ptv->capture_kernel_packets, ptv->tv->sc_perf_pca, pfring_s.recv);
        SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->sc_perf_pca, pfring_s.drop);
    }
}