feat: memory test
This commit is contained in:
parent
75ad588e0b
commit
a61b50548c
1
packages/xen-api/.gitignore
vendored
1
packages/xen-api/.gitignore
vendored
@ -7,3 +7,4 @@ npm-debug.log.*
|
|||||||
|
|
||||||
!node_modules/*
|
!node_modules/*
|
||||||
node_modules/*/
|
node_modules/*/
|
||||||
|
/plot.dat
|
||||||
|
4
packages/xen-api/memory-test.gnu
Normal file
4
packages/xen-api/memory-test.gnu
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
set yrange [ 0 : ]
|
||||||
|
set grid
|
||||||
|
|
||||||
|
plot for [i=2:4] "plot.dat" using 1:i with lines
|
@ -76,6 +76,7 @@
|
|||||||
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
|
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
|
||||||
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
|
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
|
||||||
"lint": "standard",
|
"lint": "standard",
|
||||||
|
"plot": "gnuplot -p memory-test.gnu",
|
||||||
"posttest": "npm run lint && npm run depcheck",
|
"posttest": "npm run lint && npm run depcheck",
|
||||||
"prepublish": "npm run build",
|
"prepublish": "npm run build",
|
||||||
"test": "nyc mocha --opts .mocha.opts \"dist/**/*.spec.js\""
|
"test": "nyc mocha --opts .mocha.opts \"dist/**/*.spec.js\""
|
||||||
|
20
packages/xen-api/src/memory-test.js
Normal file
20
packages/xen-api/src/memory-test.js
Normal 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()
|
Loading…
Reference in New Issue
Block a user