deviceState.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-01-11 10:44:52
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-01-11 14:42:56
  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 "Player/PlayerProxy.h"
  25. #include "Rtmp/RtmpPusher.h"
  26. #include "Common/config.h"
  27. #include "Pusher/MediaPusher.h"
  28. #include "Extension/Frame.h"
  29. #include "Util/SqlPool.h"
  30. #include "Network/TcpClient.h"
  31. #include "Poller/Timer.h"
  32. #include "monitor.h"
  33. #include <mutex>
  34. using namespace toolkit;
  35. using namespace std;
  36. namespace MIVA
  37. {
  38. class deviceState
  39. {
  40. public:
  41. using Ptr = std::shared_ptr<deviceState>;
  42. int CpuUsage;
  43. int GpuUsage;
  44. int MemoryUsage;
  45. int Temp;
  46. int FdUsage;
  47. public:
  48. deviceState();
  49. ~deviceState();
  50. /**
  51. * @description: 创建实例
  52. * @param {*}
  53. * @return {*}
  54. */
  55. static std::shared_ptr<deviceState> CreateNew();
  56. /**
  57. * @description: 获取设备数据
  58. * @param {*}
  59. * @return {*}
  60. */
  61. int32_t getDeviceState();
  62. /**
  63. * @description: 同步设备数据
  64. * @param {*}
  65. * @return {*}
  66. */
  67. int32_t SyncDeviceState(std::string& Ctime);
  68. private:
  69. mutex m_mutex;
  70. };
  71. } // namespace MIVA