syspy  0.1
syspy windows system information tool with python
test.py
Go to the documentation of this file.
1 from cpu import CPU
2 
3 cps = CPU()
4 
5 def cpuTime():
6  """
7  START Test Results
8 
9  User: 1076.952880859375 System: 534.6328125 IDLE: 29336.767578125
10 
11  a = user cpu times
12  b = system cpu times
13  c = idle cpu times
14 
15  END Test Results
16  """
17  a,b,c = cps.getCpuTimes()
18 
19  print("User: {0} System: {1} IDLE: {2}".format(a,b,c))
20 
21 def cpuPercent():
22  """
23  START Test Results
24 
25  For 10 times:
26  Current CPU Usage: 0.0
27  Current CPU Usage: 0.0
28  Current CPU Usage: 0.0
29  Current CPU Usage: 0.8
30  Current CPU Usage: 0.0
31  Current CPU Usage: 0.1
32  Current CPU Usage: 1.5
33  Current CPU Usage: 0.0
34  Current CPU Usage: 0.0
35  Current CPU Usage: 0.8
36 
37  END Test Results
38  """
39  for i in range(5):
40  print("Current CPU Usage: {0}".format(cps.getCpuPercent()))
41 
43  """
44  START Test Results
45 
46  For two processors
47  Cpu Percent Per Cpu: [7.9, 4.8]
48  Cpu Percent Per Cpu: [29.2, 29.2]
49  Cpu Percent Per Cpu: [1.6, 0.0]
50  Cpu Percent Per Cpu: [0.0, 0.0]
51  Cpu Percent Per Cpu: [0.0, 0.0]
52 
53  END Test Results
54  """
55  for i in range(5):
56  print("Cpu Percent Per Cpu: {0}".format(cps.cpuPercentPerCpu()))
57 
59  """
60  START Test Results
61 
62  CPU Times Percent:
63  User: 0.0 System: 0.0 IDLE: 100.0
64 
65  a = user cpu times percent
66  b = system cpu times percent
67  c = idle cpu times percent
68 
69  END Test Results
70  """
71  a, b, c = cps.cpuTimesPercent()
72  print("CPU Times Percent: \nUser: {0} System: {1} IDLE: {2}".format(a,b,c))
73 
75  """
76  START Test Results
77 
78  Cpu Count: 2
79  Cpu Count without Logical: 2
80 
81  a = Totally Cpu Count
82  b = Without logical
83 
84  END Test Results
85  """
86  a,b = cps.getCpuCount()
87  print("Cpu Count: {0}\nCpu Count without Logical: {1}".format(a,b))
88 
89 def caffinity():
90  """
91  START Test Results
92 
93  CPU Affinity: [0, 1]
94 
95  END Test Results
96  """
97  caffinityTest = cps.getCpuAffinity()
98  print("CPU Affinity: {0}".format(caffinityTest))
99 
100 
101 #cpuTime()
102 #cpuPercent()
103 #cpuPercentPerCpu()
104 #timesPercent()
105 #processorCount()
106 #caffinity()
def cpuPercent()
Definition: test.py:21
def cpuTime()
Definition: test.py:5
def cpuPercentPerCpu()
Definition: test.py:42
def timesPercent()
Definition: test.py:58
def processorCount()
Definition: test.py:74
def caffinity()
Definition: test.py:89