Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Mynij-unit-tests
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
Mynij-unit-tests
Commits
ce0e80f4
Commit
ce0e80f4
authored
Feb 21, 2020
by
Alexandra
Committed by
Alexandra Rogova
Feb 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now with right pid
parent
3f524a07
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1431 additions
and
1535 deletions
+1431
-1535
Milestone1/results/add_csv.csv
Milestone1/results/add_csv.csv
+256
-256
Milestone1/results/add_csv_monitor.csv
Milestone1/results/add_csv_monitor.csv
+280
-298
Milestone1/results/add_random_csv.csv
Milestone1/results/add_random_csv.csv
+256
-256
Milestone1/results/add_random_csv_monitor.csv
Milestone1/results/add_random_csv_monitor.csv
+619
-677
Milestone1/unit_tests/add_csv.js
Milestone1/unit_tests/add_csv.js
+19
-27
Milestone1/unit_tests/monitor.py
Milestone1/unit_tests/monitor.py
+1
-21
No files found.
Milestone1/results/add_csv.csv
View file @
ce0e80f4
This diff is collapsed.
Click to expand it.
Milestone1/results/add_csv_monitor.csv
View file @
ce0e80f4
This diff is collapsed.
Click to expand it.
Milestone1/results/add_random_csv.csv
View file @
ce0e80f4
This diff is collapsed.
Click to expand it.
Milestone1/results/add_random_csv_monitor.csv
View file @
ce0e80f4
This diff is collapsed.
Click to expand it.
Milestone1/unit_tests/add_csv.js
View file @
ce0e80f4
"
use strict
"
;
const
{
exec
}
=
require
(
"
child_process
"
);
var
childProcess
=
require
(
"
child_process
"
);
var
cut_file
=
require
(
"
./random_gen
"
).
cut_file
;
// var diskspace = require("diskspace");
// var os_utils = require("os-utils");
// var os = require('os');
const
puppeteer
=
require
(
"
puppeteer
"
);
const
Server
=
require
(
"
ws
"
).
Server
;
const
args
=
require
(
"
yargs
"
)
...
...
@@ -28,9 +26,7 @@ var page;
var
n
=
0
;
var
time
;
var
monitor
;
// var ramBefore;
// var memBefore;
var
browser_pid
;
var
pid
;
function
init_server
(){
var
port
=
9030
;
...
...
@@ -70,17 +66,6 @@ async function query (){
}
else
{
n
+=
1000
;
time
=
Date
.
now
();
// monitor = childProcess.fork("./unit_tests/monitor.js");
// monitor.on("message", function(msg){
// diskspace.check("C", function (err, result){
// var memUsed = (result.used/1024/1024) - memBefore;
// var ramUsed = parseInt(msg) - ramBefore;
// console.log(ramUsed/1024/1024);
// //process.send(n + "," + ramUsed + "," + memUsed + "\n");
// monitor.kill();
// query();
// });
// });
const
[
fileChooser
]
=
await
Promise
.
all
([
page
.
waitForFileChooser
(),
page
.
click
(
"
input#load
"
)
...
...
@@ -90,19 +75,26 @@ async function query (){
}
(
async
()
=>
{
files
=
cut_file
(
args
.
file
,
1000
);
init_server
();
browser
=
await
puppeteer
.
launch
();
browser_pid
=
browser
.
process
().
pid
;
page
=
await
browser
.
newPage
();
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
)
=>
{
var
page_info
=
stdout
.
split
(
"
\n
"
).
find
(
process
=>
process
.
includes
(
"
--type=renderer
"
));
pid
=
page_info
.
split
(
"
"
)[
0
];
monitor
=
childProcess
.
fork
(
"
./unit_tests/monitor.js
"
,
args
.
r
?
[
"
-r
"
,
"
-p
"
,
browser_pid
]
:
[
"
-p
"
,
browser_
pid
]);
args
.
r
?
[
"
-r
"
,
"
-p
"
,
pid
]
:
[
"
-p
"
,
pid
]);
timeout
();
query
();
// diskspace.check("C", function (err, result){
// memBefore = result.used/1024/1024;
// timeout();
// query();
// });
})
})
})();
Milestone1/unit_tests/monitor.py
View file @
ce0e80f4
...
...
@@ -12,28 +12,8 @@ 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()
process
=
psutil
.
Process
(
args
.
p
)
# snapshot = ProcessSnapshot(process)
while
(
1
)
:
#snapshot.update_memory_percent()
#client.send(str(snapshot.memory_percent))
client
.
send
(
str
(
process
.
memory_info
().
rss
))
client
.
send
(
str
((
process
.
memory_info
().
rss
)))
time
.
sleep
(
0.1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment