Commit 81a134d8 authored by Alexandra's avatar Alexandra

test with psutil memory_info

parent 8568c43c
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
items,timestamp
1000,1582278164094
2000,1582278164224
3000,1582278164332
4000,1582278164441
5000,1582278164544
6000,1582278164648
7000,1582278164751
8000,1582278164845
9000,1582278164937
10000,1582278165038
11000,1582278165141
12000,1582278165261
13000,1582278165354
14000,1582278165462
15000,1582278165562
16000,1582278165662
17000,1582278165760
18000,1582278165858
19000,1582278165956
20000,1582278166054
21000,1582278166156
22000,1582278166280
23000,1582278166372
24000,1582278166494
25000,1582278166585
26000,1582278166704
27000,1582278166802
28000,1582278166897
29000,1582278166990
30000,1582278167104
31000,1582278167202
32000,1582278167298
33000,1582278167403
34000,1582278167499
35000,1582278167591
36000,1582278167691
37000,1582278167801
38000,1582278167907
39000,1582278168034
40000,1582278168133
41000,1582278168228
42000,1582278168345
43000,1582278168447
44000,1582278168567
45000,1582278168702
46000,1582278168828
47000,1582278168929
48000,1582278169028
49000,1582278169128
50000,1582278169236
51000,1582278169357
52000,1582278169456
53000,1582278169552
54000,1582278169649
55000,1582278169745
56000,1582278169839
57000,1582278169940
58000,1582278170041
59000,1582278170137
60000,1582278170254
61000,1582278170350
62000,1582278170448
63000,1582278170544
64000,1582278170640
65000,1582278170738
66000,1582278170850
67000,1582278170956
68000,1582278171127
69000,1582278171240
70000,1582278171345
71000,1582278171480
72000,1582278171582
73000,1582278171728
74000,1582278171827
75000,1582278171923
76000,1582278172021
77000,1582278172129
78000,1582278172264
79000,1582278172362
80000,1582278172480
81000,1582278172605
82000,1582278172738
83000,1582278172854
84000,1582278172956
85000,1582278173057
86000,1582278173153
87000,1582278173251
88000,1582278173360
89000,1582278173455
90000,1582278173555
91000,1582278173667
92000,1582278173765
93000,1582278173857
94000,1582278173958
95000,1582278174055
96000,1582278174154
97000,1582278174258
98000,1582278174359
99000,1582278174456
100000,1582278174554
101000,1582278174664
102000,1582278174759
103000,1582278174858
104000,1582278174955
105000,1582278175060
106000,1582278175158
107000,1582278175256
108000,1582278175356
109000,1582278175456
110000,1582278175558
111000,1582278175661
112000,1582278175847
113000,1582278176031
114000,1582278176126
115000,1582278176223
116000,1582278176334
117000,1582278176450
118000,1582278176551
119000,1582278176654
120000,1582278176752
121000,1582278176850
122000,1582278176965
123000,1582278177064
124000,1582278177210
125000,1582278177303
126000,1582278177406
127000,1582278177508
128000,1582278177619
129000,1582278177719
130000,1582278177818
131000,1582278177917
132000,1582278178020
133000,1582278178163
134000,1582278178257
135000,1582278178367
136000,1582278178465
137000,1582278178569
138000,1582278178666
139000,1582278178761
140000,1582278178857
141000,1582278178965
142000,1582278179063
143000,1582278179158
144000,1582278179270
145000,1582278179370
146000,1582278179466
147000,1582278179563
148000,1582278179657
149000,1582278179766
150000,1582278179864
151000,1582278179975
152000,1582278180074
153000,1582278180175
154000,1582278180272
155000,1582278180385
156000,1582278180484
157000,1582278180583
158000,1582278180680
159000,1582278180790
160000,1582278180889
161000,1582278180990
162000,1582278181090
163000,1582278181192
164000,1582278181289
165000,1582278181396
166000,1582278181490
167000,1582278181590
168000,1582278181689
169000,1582278181790
170000,1582278181907
171000,1582278182007
172000,1582278182116
173000,1582278182217
174000,1582278182314
175000,1582278182440
176000,1582278182685
177000,1582278182810
178000,1582278182903
179000,1582278183013
180000,1582278183113
181000,1582278183222
182000,1582278183336
183000,1582278183437
184000,1582278183537
185000,1582278183636
186000,1582278183735
187000,1582278183832
188000,1582278183926
189000,1582278184025
190000,1582278184122
191000,1582278184226
192000,1582278184322
193000,1582278184421
194000,1582278184532
195000,1582278184625
196000,1582278184723
197000,1582278184837
198000,1582278184934
199000,1582278185035
200000,1582278185133
201000,1582278185231
202000,1582278185326
203000,1582278185426
204000,1582278185521
205000,1582278185634
206000,1582278185731
207000,1582278185825
208000,1582278185921
209000,1582278186022
210000,1582278186120
211000,1582278186235
212000,1582278186348
213000,1582278186444
214000,1582278186548
215000,1582278186643
216000,1582278186740
217000,1582278186838
218000,1582278186948
219000,1582278187056
220000,1582278187164
221000,1582278187259
222000,1582278187358
223000,1582278187456
224000,1582278187567
225000,1582278187682
226000,1582278187779
227000,1582278187875
228000,1582278187974
229000,1582278188075
230000,1582278188174
231000,1582278188275
232000,1582278188375
233000,1582278188473
234000,1582278188577
235000,1582278188675
236000,1582278188773
237000,1582278188875
238000,1582278188971
239000,1582278189098
240000,1582278189193
241000,1582278189291
242000,1582278189389
243000,1582278189489
244000,1582278189589
245000,1582278189691
246000,1582278189799
247000,1582278189899
248000,1582278189993
249000,1582278190090
250000,1582278190190
251000,1582278190290
252000,1582278190390
253000,1582278190492
254000,1582278190590
255000,1582278190697
256000,1582278190794
......@@ -12,27 +12,28 @@ import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('localhost', 9040))
class _Snapshot(object):
def get(self, property, default=None):
return getattr(self, property, default)
class ProcessSnapshot(_Snapshot):
def __init__(self, process=None):
assert type(process) is psutil.Process
self.username = process.username()
self.process_object = process
self.pid = process.pid
# Memory percentage
self.memory_percent = process.memory_percent()
def update_memory_percent(self):
if self.process_object.is_running():
self.memory_percent = self.process_object.memory_percent()
# class _Snapshot(object):
# def get(self, property, default=None):
# return getattr(self, property, default)
#
# class ProcessSnapshot(_Snapshot):
# def __init__(self, process=None):
# assert type(process) is psutil.Process
# self.username = process.username()
# self.process_object = process
# self.pid = process.pid
# # Memory percentage
# self.memory_percent = process.memory_percent()
#
# def update_memory_percent(self):
# if self.process_object.is_running():
# self.memory_percent = self.process_object.memory_percent()
process = psutil.Process(args.p)
snapshot = ProcessSnapshot(process)
# snapshot = ProcessSnapshot(process)
while (1) :
snapshot.update_memory_percent()
client.send(str(snapshot.memory_percent))
#snapshot.update_memory_percent()
#client.send(str(snapshot.memory_percent))
client.send(str(process.memory_info().rss))
time.sleep(0.1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment