feat(memory-test): split into inject-events
This commit is contained in:
parent
1191f0ba93
commit
6e0956f09f
27
packages/xen-api/src/inject-events.js
Executable file
27
packages/xen-api/src/inject-events.js
Executable 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
10
packages/xen-api/src/memory-test.js
Normal file → Executable 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()
|
||||
|
Loading…
Reference in New Issue
Block a user