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
78f3a825
Commit
78f3a825
authored
Feb 21, 2020
by
Alexandra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now with right pid
parent
81a134d8
Changes
6
Expand all
Hide 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 @
78f3a825
This diff is collapsed.
Click to expand it.
Milestone1/results/add_csv_monitor.csv
View file @
78f3a825
This diff is collapsed.
Click to expand it.
Milestone1/results/add_random_csv.csv
View file @
78f3a825
This diff is collapsed.
Click to expand it.
Milestone1/results/add_random_csv_monitor.csv
View file @
78f3a825
This diff is collapsed.
Click to expand it.
Milestone1/unit_tests/add_csv.js
View file @
78f3a825
"
use strict
"
;
"
use strict
"
;
const
{
exec
}
=
require
(
"
child_process
"
);
var
childProcess
=
require
(
"
child_process
"
);
var
childProcess
=
require
(
"
child_process
"
);
var
cut_file
=
require
(
"
./random_gen
"
).
cut_file
;
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
puppeteer
=
require
(
"
puppeteer
"
);
const
Server
=
require
(
"
ws
"
).
Server
;
const
Server
=
require
(
"
ws
"
).
Server
;
const
args
=
require
(
"
yargs
"
)
const
args
=
require
(
"
yargs
"
)
...
@@ -28,9 +26,7 @@ var page;
...
@@ -28,9 +26,7 @@ var page;
var
n
=
0
;
var
n
=
0
;
var
time
;
var
time
;
var
monitor
;
var
monitor
;
// var ramBefore;
var
pid
;
// var memBefore;
var
browser_pid
;
function
init_server
(){
function
init_server
(){
var
port
=
9030
;
var
port
=
9030
;
...
@@ -70,17 +66,6 @@ async function query (){
...
@@ -70,17 +66,6 @@ async function query (){
}
else
{
}
else
{
n
+=
1000
;
n
+=
1000
;
time
=
Date
.
now
();
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
([
const
[
fileChooser
]
=
await
Promise
.
all
([
page
.
waitForFileChooser
(),
page
.
waitForFileChooser
(),
page
.
click
(
"
input#load
"
)
page
.
click
(
"
input#load
"
)
...
@@ -90,19 +75,26 @@ async function query (){
...
@@ -90,19 +75,26 @@ async function query (){
}
}
(
async
()
=>
{
(
async
()
=>
{
files
=
cut_file
(
args
.
file
,
1000
);
files
=
cut_file
(
args
.
file
,
1000
);
init_server
();
init_server
();
browser
=
await
puppeteer
.
launch
();
browser
=
await
puppeteer
.
launch
();
browser_pid
=
browser
.
process
().
pid
;
page
=
await
browser
.
newPage
();
page
=
await
browser
.
newPage
();
await
page
.
goto
(
link
);
await
page
.
goto
(
link
);
monitor
=
childProcess
.
fork
(
"
./unit_tests/monitor.js
"
,
args
.
r
?
[
"
-r
"
,
"
-p
"
,
browser_pid
]
:
[
"
-p
"
,
browser_pid
]);
browser
.
targets
().
find
(
target
=>
target
.
_targetInfo
.
url
===
"
about:blank
"
).
page
()
timeout
();
.
then
(
function
(
p
){
query
();
p
.
close
();
// diskspace.check("C", function (err, result){
})
// memBefore = result.used/1024/1024;
.
then
(
function
(){
// timeout();
exec
(
"
ps x | grep
\"
chrome
\"
"
,
(
error
,
stdout
,
stderr
)
=>
{
// query();
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
"
,
pid
]
:
[
"
-p
"
,
pid
]);
timeout
();
query
();
})
})
})();
})();
Milestone1/unit_tests/monitor.py
View file @
78f3a825
...
@@ -12,28 +12,8 @@ import socket
...
@@ -12,28 +12,8 @@ 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
))
# 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
)
process
=
psutil
.
Process
(
args
.
p
)
# snapshot = ProcessSnapshot(process)
while
(
1
)
:
while
(
1
)
:
#snapshot.update_memory_percent()
client
.
send
(
str
((
process
.
memory_info
().
rss
)))
#client.send(str(snapshot.memory_percent))
client
.
send
(
str
(
process
.
memory_info
().
rss
))
time
.
sleep
(
0.1
)
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