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

Generated by: LCOV version 1.14