monitor.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-01-10 15:01:15
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-01-10 16:00:35
  8. */
  9. #pragma once
  10. #include <iostream>
  11. #include <map>
  12. #include <time.h>
  13. #include <dirent.h>
  14. #include <time.h>
  15. #include <cstdlib>
  16. #include <dirent.h>
  17. #include <sys/types.h>
  18. #include <sys/stat.h>
  19. #include <unistd.h>
  20. #include "Util/logger.h"
  21. #include "Util/NoticeCenter.h"
  22. #include "Poller/EventPoller.h"
  23. #include "Player/PlayerProxy.h"
  24. #include "Rtmp/RtmpPusher.h"
  25. #include "Common/config.h"
  26. #include "Pusher/MediaPusher.h"
  27. #include "Extension/Frame.h"
  28. #include "Util/SqlPool.h"
  29. #include "Network/TcpClient.h"
  30. #include "Poller/Timer.h"
  31. using namespace toolkit;
  32. using namespace std;
  33. namespace MIVA
  34. {
  35. class monitor
  36. {
  37. private:
  38. FILE *file = nullptr;
  39. public:
  40. monitor();
  41. ~monitor();
  42. /**
  43. * @description: 创建实例
  44. * @param {*}
  45. * @return {*}
  46. */
  47. static std::shared_ptr<monitor> CreateNew();
  48. /**
  49. * @description: 初始化
  50. * @param {*}
  51. * @return {*}
  52. */
  53. int32_t Init();
  54. /**
  55. * @description: 释放资源
  56. * @param {*}
  57. * @return {*}
  58. */
  59. void Destory();
  60. /**
  61. * @description: 获取内存使用情况
  62. * @param {*}
  63. * @return {*}
  64. */
  65. int32_t getMemoryUsage();
  66. /**
  67. * @description: 获取Cpu使用情况
  68. * TODO
  69. * @param {*}
  70. * @return {*}
  71. */
  72. int32_t getCpuUsage();
  73. /**
  74. * @description: 获取温度
  75. * TODO
  76. * @param {*}
  77. * @return {*}
  78. */
  79. int32_t getTemp();
  80. /**
  81. * @description: 获取Gpu使用情况
  82. * TODO
  83. * @param {*}
  84. * @return {*}
  85. */
  86. int32_t getGpuUsage();
  87. /**
  88. * @description: 获取文件句柄使用情况
  89. * @param {*}
  90. * @return {*}
  91. */
  92. int32_t getFdUsage();
  93. };
  94. } // namespace MIVA