Exemplo n.º 1
0
        /**
         * @brief Constructor
         * @param name         The name of the ComboSource block instance
         * @param invocation   Invocation type of the block (Indirect, Direct, Async)
         */
        ComboSource(const std::string &name)
            :Block(name, invocation_type::Async),              //ignore options
            m_mem_block(new MemoryBatch(4096*4))
        {
            sze = NULL;

			m_pktcnt = 0;
			m_pktagg = 1;
            register_variable("pktcnt",make_rd_var(no_mutex_t(), m_pktcnt));
            register_variable("pktagg",make_wr_var(no_mutex_t(), m_pktagg));
        }
Exemplo n.º 2
0
   /**
    * @brief Constructor
    * @param name         The name of the packet counter block
    * @param invocation   Invocation type of the block (Indirect, Direct, Async)
    */
   PassthroughPacketCounter(const std::string &name, invocation_type invocation)
   : Block(name, invocation),
   m_pkt_cnt(0),
   m_byte_cnt(0),
   m_pkt_rate(0),
   m_byte_rate(0),
   m_reset(0),
   m_pkt_cnt_prev(0),
   m_byte_cnt_prev(0),
   m_last_t(std::chrono::system_clock::now()),
   m_timer(true),
 m_ingate_id(register_input_gate("in_pkt")),
 m_outgate_id(register_output_gate("out_pkt"))
   {
       register_variable("byterate",make_rd_var(no_mutex_t(), m_byte_rate));
       register_variable("pktrate",make_rd_var(no_mutex_t(), m_pkt_rate));
       register_variable("pktcnt",make_rd_var(no_mutex_t(), m_pkt_cnt));
       register_variable("bytecnt",make_rd_var(no_mutex_t(), m_byte_cnt));
       register_variable("reset",make_wr_var(no_mutex_t(), m_reset));
   }