feat(memory-test): split into inject-events

This commit is contained in:
Julien Fontanet 2016-05-11 11:30:49 +02:00
parent 1191f0ba93
commit 6e0956f09f
2 changed files with 33 additions and 4 deletions

View File

@ -0,0 +1,27 @@
#!/usr/bin/env node
import { createClient } from './'
const xapi = (() => {
const [ , , url, user, password ] = process.argv
return createClient({
auth: { user, password },
url,
watchEvents: false
})
})()
xapi.connect()
// Get the pool record's ref.
.then(() => xapi.call('pool.get_all'))
// Injects lots of events.
.then(([ poolRef ]) => {
const loop = () => xapi.call('event.inject', 'pool', poolRef)
.delay(10) // A small delay is required to avoid overloading the Xen API.
.then(loop)
return loop()
})

10
packages/xen-api/src/memory-test.js Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
import { createClient } from './'
let i = 0
@ -8,13 +10,13 @@ setInterval(() => {
i++,
Math.round(usage.rss / 1e6),
Math.round(usage.heapTotal / 1e6),
Math.round(usage.heapUsed / 1e6))
Math.round(usage.heapUsed / 1e6)
)
}, 1e2)
const [ , , url, user, password ] = process.argv
const xapi = createClient({
createClient({
auth: { user, password },
readOnly: true,
url
})
xapi.connect()
}).connect()