Commit b332f184 authored by Alexandra's avatar Alexandra

now ram usage is sum of all chrome pids

parent b0cfb8a2
This diff is collapsed.
This diff is collapsed.
items,timestamp items,timestamp
1000,1582286992048
2000,1582286992324
3000,1582286992611
4000,1582286992864
5000,1582286993114
6000,1582286993362
7000,1582286993610
8000,1582286993870
9000,1582286994123
10000,1582286994369
11000,1582286994609
12000,1582286994857
13000,1582286995096
14000,1582286995331
15000,1582286995580
16000,1582286995824
17000,1582286996060
18000,1582286996302
19000,1582286996537
20000,1582286996773
21000,1582286997011
22000,1582286997262
23000,1582286997506
24000,1582286997742
25000,1582286997977
26000,1582286998218
27000,1582286998456
28000,1582286998695
29000,1582286998934
30000,1582286999172
31000,1582286999411
32000,1582286999656
33000,1582286999909
34000,1582287000145
35000,1582287000400
36000,1582287000645
37000,1582287000884
38000,1582287001128
39000,1582287001366
40000,1582287001607
41000,1582287001858
42000,1582287002090
43000,1582287002332
44000,1582287002575
45000,1582287002808
46000,1582287003044
47000,1582287003286
48000,1582287003530
49000,1582287003803
50000,1582287004045
51000,1582287004283
52000,1582287004539
53000,1582287004778
54000,1582287005021
55000,1582287005280
56000,1582287005518
57000,1582287005752
58000,1582287005990
59000,1582287006226
60000,1582287006463
61000,1582287006702
62000,1582287006939
63000,1582287007175
64000,1582287007447
65000,1582287007693
66000,1582287007933
67000,1582287008179
68000,1582287008418
69000,1582287008658
70000,1582287008891
71000,1582287009131
72000,1582287009368
73000,1582287009601
74000,1582287009887
75000,1582287010137
76000,1582287010373
77000,1582287010608
78000,1582287010852
79000,1582287011088
80000,1582287011330
81000,1582287011591
82000,1582287011834
83000,1582287012081
84000,1582287012326
85000,1582287012565
86000,1582287012801
87000,1582287013037
88000,1582287013284
89000,1582287013518
90000,1582287013755
91000,1582287013992
92000,1582287014228
93000,1582287014465
94000,1582287014700
95000,1582287014933
96000,1582287015171
97000,1582287015423
98000,1582287015660
99000,1582287015896
100000,1582287016134
101000,1582287016370
102000,1582287016616
103000,1582287016851
104000,1582287017090
105000,1582287017326
106000,1582287017559
107000,1582287017813
108000,1582287018047
109000,1582287018280
110000,1582287018536
111000,1582287018816
112000,1582287019048
113000,1582287019297
114000,1582287019533
115000,1582287019767
116000,1582287020006
117000,1582287020265
118000,1582287020503
119000,1582287020764
120000,1582287020997
121000,1582287021231
122000,1582287021471
123000,1582287021704
124000,1582287021942
125000,1582287022180
126000,1582287022413
127000,1582287022649
128000,1582287022893
129000,1582287023131
130000,1582287023366
131000,1582287023602
132000,1582287023836
133000,1582287024069
134000,1582287024310
135000,1582287024544
136000,1582287024806
137000,1582287025042
138000,1582287025276
139000,1582287025519
140000,1582287025754
141000,1582287025987
142000,1582287026235
143000,1582287026471
144000,1582287026704
145000,1582287026940
146000,1582287027177
147000,1582287027417
148000,1582287027653
149000,1582287027888
150000,1582287028122
151000,1582287028361
152000,1582287028597
153000,1582287028828
154000,1582287029068
155000,1582287029302
156000,1582287029535
157000,1582287029771
158000,1582287030006
159000,1582287030242
160000,1582287030483
161000,1582287030717
162000,1582287030953
163000,1582287031202
164000,1582287031438
165000,1582287031679
166000,1582287032034
167000,1582287032278
168000,1582287032517
169000,1582287032756
170000,1582287033014
171000,1582287033255
172000,1582287033494
173000,1582287033736
174000,1582287033993
175000,1582287034246
176000,1582287034486
177000,1582287034741
178000,1582287034977
179000,1582287035215
180000,1582287035460
181000,1582287035696
182000,1582287035931
183000,1582287036181
184000,1582287036417
185000,1582287036653
186000,1582287036891
187000,1582287037123
188000,1582287037360
189000,1582287037614
190000,1582287037848
191000,1582287038085
192000,1582287038322
193000,1582287038555
194000,1582287038797
195000,1582287039036
196000,1582287039267
197000,1582287039521
198000,1582287039761
199000,1582287039996
200000,1582287040236
201000,1582287040476
202000,1582287040711
203000,1582287040948
204000,1582287041186
205000,1582287041421
206000,1582287041662
207000,1582287041905
208000,1582287042137
209000,1582287042379
210000,1582287042613
211000,1582287042846
212000,1582287043187
213000,1582287043426
214000,1582287043664
215000,1582287043899
216000,1582287044146
217000,1582287044385
218000,1582287044630
219000,1582287044866
220000,1582287045101
221000,1582287045340
222000,1582287045576
223000,1582287045822
224000,1582287046059
225000,1582287046295
226000,1582287046535
227000,1582287046769
228000,1582287047004
229000,1582287047244
230000,1582287047476
231000,1582287047709
232000,1582287047950
233000,1582287048179
234000,1582287048414
235000,1582287048655
236000,1582287048889
237000,1582287049126
238000,1582287049365
239000,1582287049601
240000,1582287049839
241000,1582287050075
242000,1582287050310
243000,1582287050546
244000,1582287050785
245000,1582287051018
246000,1582287051254
247000,1582287051496
248000,1582287051831
249000,1582287052078
250000,1582287052330
251000,1582287052567
252000,1582287052805
253000,1582287053046
254000,1582287053278
255000,1582287053515
256000,1582287053768
...@@ -26,7 +26,8 @@ var page; ...@@ -26,7 +26,8 @@ var page;
var n = 0; var n = 0;
var time; var time;
var monitor; var monitor;
var pid; var args_to_pass = [];
if (args.r) args_to_pass.push("-r");
function init_server (){ function init_server (){
var port = 9030; var port = 9030;
...@@ -82,19 +83,18 @@ async function query (){ ...@@ -82,19 +83,18 @@ async function query (){
page = await browser.newPage(); page = await browser.newPage();
await page.goto(link); await page.goto(link);
browser.targets().find(target => target._targetInfo.url === "about:blank").page()
.then(function(p){
p.close();
})
.then(function(){
exec("ps x | grep \"chrome\"", (error, stdout, stderr) => { exec("ps x | grep \"chrome\"", (error, stdout, stderr) => {
var page_info = stdout.split("\n").find(process => process.includes("--type=renderer")); args_to_pass.push("-p");
pid = page_info.split(" ")[0]; var pids = "";
monitor = childProcess.fork("./unit_tests/monitor.js", var processes = stdout.split("\n");
args.r ? ["-r", "-p", pid] : ["-p", pid]); processes.forEach((item) => {
if (!item.includes("grep")) pids += item.trim().split(" ")[0] + " "
});
args_to_pass.push(pids.trim());
monitor = childProcess.fork("./unit_tests/monitor.js", args_to_pass);
timeout(); timeout();
query(); query();
}) });
})
})(); })();
...@@ -3,7 +3,7 @@ var diskspace = require("diskspace"); ...@@ -3,7 +3,7 @@ var diskspace = require("diskspace");
const args = require("yargs").argv; const args = require("yargs").argv;
var childProcess = require("child_process"); var childProcess = require("child_process");
var pid = args.p; var pids = args.p;
var path = args.r var path = args.r
? "./results/add_random_csv_monitor.csv" ? "./results/add_random_csv_monitor.csv"
: "./results/add_csv_monitor.csv"; : "./results/add_csv_monitor.csv";
...@@ -32,7 +32,7 @@ function init_monitor(){ ...@@ -32,7 +32,7 @@ function init_monitor(){
server.listen(port, function() {}); server.listen(port, function() {});
var monitor = childProcess.spawn('python', var monitor = childProcess.spawn('python',
["./unit_tests/monitor.py", "--p", pid], ["./unit_tests/monitor.py", "--p", pids],
{ stdio: 'inherit' }); { stdio: 'inherit' });
} }
......
...@@ -5,15 +5,18 @@ import time ...@@ -5,15 +5,18 @@ import time
import argparse import argparse
parser = argparse.ArgumentParser(description='') parser = argparse.ArgumentParser(description='')
parser.add_argument("--p", type=int, help="pid") parser.add_argument("--p", help="pid")
args = parser.parse_args() args = parser.parse_args()
pids = args.p.split(" ")
import socket import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('localhost', 9040)) client.connect(('localhost', 9040))
process = psutil.Process(args.p) processes = list(map(lambda pid : psutil.Process(int(pid)), pids))
while (1) : while (1) :
client.send(str((process.memory_info().rss)/1024/1024)) ram = sum(list(map(lambda p : (p.memory_info().rss)/1024/1024, processes)))
client.send(str(ram))
time.sleep(0.1) 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