deviceState.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-01-11 10:44:52
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-07-08 09:18:27
  8. */
  9. #pragma once
  10. #include <iostream>
  11. #include <iostream>
  12. #include <map>
  13. #include <time.h>
  14. #include <dirent.h>
  15. #include <time.h>
  16. #include <cstdlib>
  17. #include <dirent.h>
  18. #include <sys/types.h>
  19. #include <sys/stat.h>
  20. #include <unistd.h>
  21. #include "Util/logger.h"
  22. #include "Util/NoticeCenter.h"
  23. #include "Poller/EventPoller.h"
  24. #include "Util/SqlPool.h"
  25. #include "Network/TcpClient.h"
  26. #include "Poller/Timer.h"
  27. #include "monitor.h"
  28. #include <mutex>
  29. using namespace toolkit;
  30. using namespace std;
  31. namespace gsd_ds
  32. {
  33. class deviceState
  34. {
  35. public:
  36. using Ptr = std::shared_ptr<deviceState>;
  37. int CpuUsage;
  38. int GpuUsage;
  39. int MemoryUsage;
  40. int CpuTemp;
  41. int GpuTemp = 0;
  42. int AUXTemp = 0;
  43. int A0Temp = 0;
  44. int ThermalTemp = 0;
  45. int FdUsage;
  46. public:
  47. deviceState();
  48. ~deviceState();
  49. /**
  50. * @description: 创建实例
  51. * @param {*}
  52. * @return {*}
  53. */
  54. static std::shared_ptr<deviceState> CreateNew();
  55. /**
  56. * @description: 获取设备数据
  57. * @param {*}
  58. * @return {*}
  59. */
  60. int32_t getDeviceState();
  61. /**
  62. * @description: 同步设备数据
  63. * @param {*}
  64. * @return {*}
  65. */
  66. int32_t SyncDeviceState(std::string& Ctime);
  67. /**
  68. * @description:同步fd阈值
  69. * @param {*}
  70. * @return {*}
  71. */
  72. int32_t SyncFdThreshold(int sourceNum, bool outState);
  73. private:
  74. mutex m_mutex;
  75. };
  76. } // namespace gsd_ds