LCOV - code coverage report
Current view: top level - vnsw/agent/uve - vm_stat.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 1 0.0 %
Date: 2026-11-09 02:10:49 Functions: 0 1 0.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 vnsw_agent_vm_stat_h
       7             : #define vnsw_agent_vm_stat_h
       8             : 
       9             : #include <vector>
      10             : #include <sandesh/common/vns_types.h>
      11             : #include <virtual_machine_types.h>
      12             : #include <boost/uuid/uuid_io.hpp>
      13             : #include "base/timer.h"
      14             : #include <cmn/agent_cmn.h>
      15             : 
      16             : class VmStatData;
      17             : 
      18             : class VmStat {
      19             : public:
      20             :     static const size_t kBufLen = 4098;
      21             :     static const uint32_t kRetryCount = 3;
      22             :     static const uint16_t kInvalidCpuCount = 0xFFFF;
      23             :     typedef boost::function<void(void)> DoneCb;
      24             : 
      25             :     VmStat(Agent *agent, const boost::uuids::uuid &vm_uuid);
      26             :     virtual ~VmStat();
      27           0 :     bool marked_delete() const { return marked_delete_; }
      28             : 
      29             :     virtual void Start();
      30             :     void Stop();
      31             :     void ProcessData();
      32             : private:
      33             :     bool BuildVmStatsMsg(VirtualMachineStats *uve);
      34             :     bool BuildVmMsg(UveVirtualMachineAgent *uve);
      35             :     void ReadData(const boost::system::error_code &ec, size_t read_bytes,
      36             :                   DoneCb &cb);
      37             :     virtual bool TimerExpiry();
      38             : 
      39             : protected:
      40             :     void StartTimer();
      41             :     void ExecCmd(std::string cmd, DoneCb cb);
      42             :     void SendVmCpuStats();
      43             : 
      44             :     Agent *agent_;
      45             :     const boost::uuids::uuid vm_uuid_;
      46             :     uint32_t mem_usage_;
      47             :     uint32_t virt_memory_;
      48             :     uint32_t virt_memory_peak_;
      49             :     uint32_t vm_memory_quota_;
      50             :     double   prev_cpu_stat_;
      51             :     double   cpu_usage_;
      52             :     time_t   prev_cpu_snapshot_time_;
      53             :     std::vector<double> prev_vcpu_usage_;
      54             :     std::vector<double> vcpu_usage_percent_;
      55             :     time_t   prev_vcpu_snapshot_time_;
      56             :     char     rx_buff_[kBufLen];
      57             :     std::stringstream data_;
      58             :     boost::asio::posix::stream_descriptor input_;
      59             :     Timer *timer_;
      60             :     bool marked_delete_;
      61             :     uint32_t pid_;
      62             :     uint32_t retry_;
      63             :     DoneCb call_back_;
      64             :     uint32_t virtual_size_;
      65             :     uint32_t disk_size_;
      66             :     std::string disk_name_;
      67             :     VrouterAgentVmState::type vm_state_;
      68             :     VrouterAgentVmState::type prev_vm_state_;
      69             :     uint16_t vm_cpu_count_;
      70             :     uint16_t prev_vm_cpu_count_;
      71             :     DISALLOW_COPY_AND_ASSIGN(VmStat);
      72             : };
      73             : #endif // vnsw_agent_vm_stat_h

Generated by: LCOV version 1.14