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