LCOV - code coverage report
Current view: top level - root/contrail/src/contrail-common/sandesh/library/cpp - sandesh_statistics.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 1 2 50.0 %
Date: 2026-11-09 02:10:49 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef __SANDESH_STATISTICS_H__
       7             : #define __SANDESH_STATISTICS_H__
       8             : 
       9             : #include <boost/ptr_container/ptr_map.hpp>
      10             : #include <sandesh/sandesh_uve_types.h>
      11             : 
      12             : class SandeshMessageStatistics {
      13             : public:
      14         300 :     SandeshMessageStatistics() {deleted_ = false;}
      15             : 
      16             :     void UpdateSend(const std::string &msg_name, uint64_t bytes);
      17             :     void UpdateSendFailed(const std::string &msg_name, uint64_t bytes,
      18             :                           SandeshTxDropReason::type dreason);
      19             :     void UpdateRecv(const std::string &msg_name, uint64_t bytes);
      20             :     void UpdateRecvFailed(const std::string &msg_name, uint64_t bytes,
      21             :                           SandeshRxDropReason::type dreason);
      22             :     void Clear();
      23             : 
      24             :     // Detail statistics
      25             :     typedef boost::ptr_map<std::string, SandeshMessageTypeStats>
      26             :         DetailStatsMap;
      27             :     typedef std::vector<SandeshMessageTypeStats> DetailStatsList;
      28             : 
      29             :     void Get(DetailStatsList *v_detail_type_stats,
      30             :         SandeshMessageStats *detail_agg_stats) const;
      31             :     void Get(DetailStatsMap *m_detail_type_stats,
      32             :         SandeshMessageStats *detail_agg_stats) const;
      33             : 
      34             :     // Basic statistics
      35             :     typedef std::vector<SandeshMessageTypeBasicStats> BasicStatsList;
      36             : 
      37             :     void Get(BasicStatsList *v_basic_type_stats,
      38             :         SandeshMessageBasicStats *basic_agg_stats) const;
      39             :     void Shutdown();
      40             : 
      41             : private:
      42             :     bool deleted_;
      43             :     void UpdateInternal(const std::string &msg_name,
      44             :                         uint64_t bytes, bool is_tx, bool dropped,
      45             :                         SandeshTxDropReason::type send_dreason,
      46             :                         SandeshRxDropReason::type recv_dreason);
      47             : 
      48             :     DetailStatsMap detail_type_stats_map_;
      49             :     SandeshMessageStats detail_agg_stats_;
      50             : };
      51             : 
      52             : class SandeshEventStatistics {
      53             : public:
      54           0 :     SandeshEventStatistics() {deleted_ = false;}
      55             : 
      56             :     void Update(std::string &event_name, bool enqueue, bool fail);
      57             :     void Get(std::vector<SandeshStateMachineEvStats> *ev_stats) const;
      58             :     void Shutdown();
      59             : 
      60             :     typedef boost::ptr_map<std::string, SandeshStateMachineEvStats> EventStatsMap;
      61             :     EventStatsMap event_stats_;
      62             :     SandeshStateMachineEvStats agg_stats_;
      63             : private:
      64             :     bool deleted_;
      65             : };
      66             : 
      67             : #endif // __SANDESH_STATISTICS_H__

Generated by: LCOV version 1.14