syspy  0.1
syspy windows system information tool with python
test.py
Go to the documentation of this file.
1 from memory import Memory
2 
3 mem = Memory()
4 
5 def virtualMem():
6  """
7  START Test Results
8 
9  Total: 2.0G Available: 912.5M Percent: 55.3 Used: 1.1G Free: 912.5M
10 
11  END Test Results
12 
13  START return values
14 
15  a = total
16  b = available
17  c = percent
18  d = used
19  e = free
20 
21  END return values
22  """
23  a,b,c,d,e = mem.getVirtualMemory()
24 
25  print("Total: {0} Available: {1} Percent: {2} Used: {3} Free: {4}".format(a,b,c,d,e))
26 
27 def swapMem():
28  """
29  START Test Results
30 
31  Total: 4.0G Used: 1.7G Free: 2.3G Percent: 42.3 Sin: 0B Sout: 0B
32 
33  END Test Results
34 
35  START return values
36 
37  a = total swap memory
38  b = used swap memory
39  c = free swap memory
40  d = swap memory percent
41  d = the number of bytes the system has swapped in from disk
42  e = the number of bytes the system has swapped out from disk
43 
44  END return values
45  """
46  a,b,c,d,e,f = mem.getSwapMemory()
47  print("Total: {0} Used: {1} Free: {2} Percent: {3} Sin: {4} Sout: {5}".format(a,b,c,d,e,f))
48 
49 def memoryInfo():
50  """
51  START Test Results
52 
53  RSS: 8.1M VMS: 5.3M
54 
55  END Test Results
56 
57  START return values
58 
59  a = RSS(Resident Set Size)
60  b = VMS(Virtual Memory Size)
61 
62  END return values
63  """
64  a,b = mem.getMemoryInfo()
65  print("RSS: {0} VMS: {1}".format(a,b))
66 
68  """
69  START Test Results
70 
71  num_page_faults: 2.2K
72  peak_wset: 8.0M
73  wset: 8.0M
74  peak_paged_pool: 98.6K
75  paged tools: 98.6K
76  peak_nonpaged_pool: 4.4K
77  nonpaged_pool: 4.4K
78  pagefile: 5.2M
79  peak_pagefile: 5.2M
80  private: 5.2M
81 
82  END Test Results
83 
84  START return values
85 
86  a = num_page_faults
87  b = peak_wset
88  c = wset
89  d = peak_paged_pool
90  e = paged_tool
91  f = peak_nonpaged_pool
92  g = nonpaged_pool
93  h = pagefile
94  i = peak_pagefile
95  j = private
96 
97  http://pythonhosted.org/psutil/#psutil.Process.memory_info_ex
98 
99  END return values
100  """
101  a,b,c,d,e,f,g,h,i,j = mem.getMemoryInfoEx()
102 
103  print("num_page_faults: {0}\npeak_wset: {1}\nwset: {2}\npeak_paged_pool: {3}\n" \
104  "paged_tool: {4}\npeak_nonpaged_pool: {5}\nnonpaged_pool: {6}\n" \
105  "pagefile: {7}\npeak_pagefile: {8}\nprivate: {9}".format(a,b,c,d,e,f,g,h,i,j))
106 
107 
109  """
110  START Test Results
111 
112  Memory Percent: 0.3964004619891539
113 
114  END Test Results
115  """
116  mpercent = mem.getMemoryPercent()
117  print("Memory Percent: {0}".format(mpercent))
118 
119 def memoryMap():
120  """
121  START Test Results
122  PID: 6128
123  Name: conhost.exe
124  RSS: 4.0K
125  Permission: r
126  Path: C:\Windows\System32\apisetschema.dll
127  Total RSS: 24.5M
128  END Test Results
129 
130  START return values
131 
132  PID: Process ID
133  NAME: Process Name
134  RSS: Resident Set Size
135  Permission: Process Permission
136  Path: Process Api Path
137  Total RSS: Total Resident Set Size
138 
139  END return values
140  """
141 
142  a,b,c,d,e,f = mem.getMemoryMap(5128)
143  print("PID: {0}\nName: {1}\nRSS: {2}\nPermission: {3}\nPath: {4}\nTotal RSS: {5}".format(a,b,c,d,e,f))
144 
145 #virtualMem()
146 #swapMem()
147 #memoryInfo()
148 #memoryInfoEx()
149 #memoryPercent()
150 #memoryMap()
def swapMem()
Definition: test.py:27
def memoryInfo()
Definition: test.py:49
def memoryMap()
Definition: test.py:119
def memoryInfoEx()
Definition: test.py:67
def memoryPercent()
Definition: test.py:108
def virtualMem()
Definition: test.py:5