コード例 #1
0
ファイル: TweetReader.cpp プロジェクト: cnplab/blockmon
 /**
  * @brief Constructor
  * @param name The name of the source block
  * @param invocation Invocation type of the block (Indirect, Direct, Async).
  *                     This block can only be async invoked,
  *                     and will ignore any contrary configuration.
  */
 TweetReader(const std::string &name, invocation_type invocation)
     :Block(name, invocation_type::Async),
     next_out_port(0)
     {
         if (invocation != invocation_type::Async) {
             blocklog("TweetReader must be Async, ignoring configuration", log_warning);
         }
         m_msg_sent = 0;
         m_msg_recv = 0;
         outgate_basename = "out_tweet";
         m_msg_type = type_to_id<Tweet>::id();
         register_variable("msg_sent",make_rd_var(no_mutex_t(), m_msg_sent));
         register_variable("msg_recv",make_rd_var(no_mutex_t(), m_msg_recv));
     }
コード例 #2
0
ファイル: ComboSource.hpp プロジェクト: Aeronbroker/blockmon
        /**
         * @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));
        }
コード例 #3
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));
   }