OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agent_stats_collector.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_stats_collector_h
6 #define vnsw_agent_stats_collector_h
7 
8 #include <ksync/ksync_index.h>
9 #include <ksync/ksync_entry.h>
10 #include <ksync/ksync_object.h>
11 #include <ksync/ksync_netlink.h>
12 #include <ksync/ksync_sock.h>
13 
14 #include <cmn/agent_cmn.h>
15 #include <uve/stats_collector.h>
16 #include <boost/scoped_ptr.hpp>
18 
19 //Defines the functionality to periodically poll interface, vrf and drop
20 //statistics from vrouter and updates its data-structures with this
21 //information. Stats collection request runs in the context of
22 //"Agent::StatsCollector" which has exclusion with "db::DBTable",
23 //"sandesh::RecvQueue", "bgp::Config" & "Agent::KSync"
24 //Stats collection response runs in the context of "Agent::Uve" which has
25 //exclusion with "db::DBTable"
27 public:
28  enum StatsType {
32  };
33 
34  AgentStatsCollector(boost::asio::io_context &io, Agent *agent);
35  virtual ~AgentStatsCollector();
36  Agent* agent() const { return agent_; }
37 
38  void SendInterfaceBulkGet();
39  void SendVrfStatsBulkGet();
40  void SendDropStatsBulkGet();
41  bool Run();
42  void RegisterDBClients();
43  void Shutdown(void);
44  virtual IoContext *AllocateIoContext(char* buf, uint32_t buf_len,
45  StatsType type, uint32_t seq);
46 protected:
47  boost::scoped_ptr<AgentStatsSandeshContext> intf_stats_sandesh_ctx_;
48  boost::scoped_ptr<AgentStatsSandeshContext> vrf_stats_sandesh_ctx_;
49  boost::scoped_ptr<AgentStatsSandeshContext> drop_stats_sandesh_ctx_;
50 private:
51  void SendAsync(char* buf, uint32_t buf_len, StatsType type);
52  bool SendRequest(Sandesh &encoder, StatsType type);
53 
56 };
57 
58 #endif //vnsw_agent_stats_collector_h
boost::scoped_ptr< AgentStatsSandeshContext > intf_stats_sandesh_ctx_
void SendAsync(char *buf, uint32_t buf_len, StatsType type)
AgentStatsCollector(boost::asio::io_context &io, Agent *agent)
uint8_t type
Definition: load_balance.h:109
Definition: agent.h:358
bool SendRequest(Sandesh &encoder, StatsType type)
boost::scoped_ptr< AgentStatsSandeshContext > vrf_stats_sandesh_ctx_
DISALLOW_COPY_AND_ASSIGN(AgentStatsCollector)
virtual IoContext * AllocateIoContext(char *buf, uint32_t buf_len, StatsType type, uint32_t seq)
boost::scoped_ptr< AgentStatsSandeshContext > drop_stats_sandesh_ctx_