6d55cf39ac8935dfa9dd0bdac13d138c0bbd845a.svn-base 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package cn.com.goldenwater.target;
  2. import cn.com.goldenwater.dcproj.utils.Arith;
  3. /**
  4. * CPU相关信息
  5. *
  6. * @author ruoyi
  7. */
  8. public class Cpu
  9. {
  10. /**
  11. * 核心数
  12. */
  13. private int cpuNum;
  14. /**
  15. * CPU总的使用率
  16. */
  17. private double total;
  18. /**
  19. * CPU系统使用率
  20. */
  21. private double sys;
  22. /**
  23. * CPU用户使用率
  24. */
  25. private double used;
  26. /**
  27. * CPU当前等待率
  28. */
  29. private double wait;
  30. /**
  31. * CPU当前空闲率
  32. */
  33. private double free;
  34. public int getCpuNum()
  35. {
  36. return cpuNum;
  37. }
  38. public void setCpuNum(int cpuNum)
  39. {
  40. this.cpuNum = cpuNum;
  41. }
  42. public double getTotal()
  43. {
  44. return Arith.round(Arith.mul(total, 100), 2);
  45. }
  46. public void setTotal(double total)
  47. {
  48. this.total = total;
  49. }
  50. public double getSys()
  51. {
  52. return Arith.round(Arith.mul(sys / total, 100), 2);
  53. }
  54. public void setSys(double sys)
  55. {
  56. this.sys = sys;
  57. }
  58. public double getUsed()
  59. {
  60. return Arith.round(Arith.mul(used / total, 100), 2);
  61. }
  62. public void setUsed(double used)
  63. {
  64. this.used = used;
  65. }
  66. public double getWait()
  67. {
  68. return Arith.round(Arith.mul(wait / total, 100), 2);
  69. }
  70. public void setWait(double wait)
  71. {
  72. this.wait = wait;
  73. }
  74. public double getFree()
  75. {
  76. return Arith.round(Arith.mul(free / total, 100), 2);
  77. }
  78. public void setFree(double free)
  79. {
  80. this.free = free;
  81. }
  82. @Override
  83. public String toString() {
  84. return "Cpu{" +
  85. "cpuNum=" + cpuNum +
  86. ", total=" + total +
  87. ", sys=" + sys +
  88. ", used=" + used +
  89. ", wait=" + wait +
  90. ", free=" + free +
  91. '}';
  92. }
  93. }