diff --git a/packages/xen-api/.gitignore b/packages/xen-api/.gitignore index 6959be1cf..d5cad6a33 100644 --- a/packages/xen-api/.gitignore +++ b/packages/xen-api/.gitignore @@ -7,3 +7,4 @@ npm-debug.log.* !node_modules/* node_modules/*/ +/plot.dat diff --git a/packages/xen-api/memory-test.gnu b/packages/xen-api/memory-test.gnu new file mode 100644 index 000000000..7f762c3f1 --- /dev/null +++ b/packages/xen-api/memory-test.gnu @@ -0,0 +1,4 @@ +set yrange [ 0 : ] +set grid + +plot for [i=2:4] "plot.dat" using 1:i with lines diff --git a/packages/xen-api/package.json b/packages/xen-api/package.json index b5a06e0b7..5cfe430b0 100644 --- a/packages/xen-api/package.json +++ b/packages/xen-api/package.json @@ -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\"" diff --git a/packages/xen-api/src/memory-test.js b/packages/xen-api/src/memory-test.js new file mode 100644 index 000000000..675cdba2b --- /dev/null +++ b/packages/xen-api/src/memory-test.js @@ -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()