feat: memory test

This commit is contained in:
Julien Fontanet 2016-05-09 17:56:14 +02:00
parent 75ad588e0b
commit a61b50548c
4 changed files with 26 additions and 0 deletions

View File

@ -7,3 +7,4 @@ npm-debug.log.*
!node_modules/*
node_modules/*/
/plot.dat

View File

@ -0,0 +1,4 @@
set yrange [ 0 : ]
set grid
plot for [i=2:4] "plot.dat" using 1:i with lines

View File

@ -76,6 +76,7 @@
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
"lint": "standard",
"plot": "gnuplot -p memory-test.gnu",
"posttest": "npm run lint && npm run depcheck",
"prepublish": "npm run build",
"test": "nyc mocha --opts .mocha.opts \"dist/**/*.spec.js\""

View File

@ -0,0 +1,20 @@
import { createClient } from './'
let i = 0
setInterval(() => {
const usage = process.memoryUsage()
console.log(
'%s %s %s %s',
i++,
Math.round(usage.rss / 1e6),
Math.round(usage.heapTotal / 1e6),
Math.round(usage.heapUsed / 1e6))
}, 1e2)
const [ , , url, user, password ] = process.argv
const xapi = createClient({
auth: { user, password },
readOnly: true,
url
})
xapi.connect()