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
f7134452
Commit
f7134452
authored
Oct 09, 2019
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced pptr metrics with nodejs's os
parent
feaa3ebe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
load_index.js
load_index.js
+11
-12
No files found.
load_index.js
View file @
f7134452
var
os
=
require
(
'
os
'
);
var
args
=
require
(
"
yargs
"
)
.
usage
(
"
Usage : load_index.js -saveAs metadata/attachment -file file_path
"
)
.
demandOption
([
'
file
'
])
...
...
@@ -16,7 +17,7 @@ if (!(args.saveAs === "metadata" ||args.saveAs === "attachment")){
var
saveAs
=
args
.
saveAs
;
const
puppeteer
=
require
(
'
puppeteer
'
);
var
browser
,
page
;
var
browser
,
page
,
ramBefore
,
memBefore
;
const
si
=
require
(
"
systeminformation
"
);
...
...
@@ -26,14 +27,13 @@ var ws = new Server({port: port});
ws
.
on
(
'
connection
'
,
function
(
w
){
w
.
on
(
'
message
'
,
function
(
msg
){
console
.
log
(
msg
);
page
.
metrics
()
.
then
(
function
(
values
){
console
.
log
(
values
.
JSHeapUsedSize
/
1024
/
1024
);
si
.
mem
(
function
(
data
){
console
.
log
(
data
.
used
/
1024
/
1024
);
});
browser
.
close
();
});
var
ramAfter
=
(
os
.
totalmem
()
-
os
.
freemem
())
/
1024
/
1024
;
var
ramUsed
=
ramAfter
-
ramBefore
;
console
.
log
(
"
Ram used :
"
+
ramUsed
+
"
MB
"
);
si
.
mem
(
function
(
data
){
console
.
log
(
"
Memory used :
"
+
(
data
.
used
/
1024
/
1024
-
memBefore
)
+
"
MB
"
);
});
browser
.
close
();
});
w
.
on
(
'
close
'
,
function
()
{
ws
.
close
();
...
...
@@ -43,10 +43,9 @@ ws.on('connection', function(w){
(
async
()
=>
{
browser
=
await
puppeteer
.
launch
();
page
=
await
browser
.
newPage
();
var
metrics
=
await
page
.
metrics
();
console
.
log
(
metrics
.
JSHeapUsedSize
/
1024
/
1024
);
ramBefore
=
(
os
.
totalmem
()
-
os
.
freemem
())
/
1024
/
1024
;
si
.
mem
(
function
(
data
){
console
.
log
(
data
.
used
/
1024
/
1024
)
;
memBefore
=
data
.
used
/
1024
/
1024
;
});
await
page
.
goto
(
'
https://softinst115787.host.vifib.net/public/unit_tests/index_load.html?saveAs=
'
+
saveAs
);
const
[
fileChooser
]
=
await
Promise
.
all
([
...
...
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