Commit f7134452 authored by root's avatar root

replaced pptr metrics with nodejs's os

parent feaa3ebe
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([
......
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