Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
parent
f81e2b1e54
commit
cc9a2b87e7
41
test/test-singlestep2.js
Normal file
41
test/test-singlestep2.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Remote single stepping using RPC (controller)
|
||||
// jamsh test-singlestep1.js -- 9001
|
||||
// ...
|
||||
var N=2,verbose=0,runCount=0;
|
||||
var workers = [
|
||||
'udp://localhost:9001',
|
||||
'udp://localhost:9002',
|
||||
'udp://localhost:9003',
|
||||
'udp://localhost:9004'
|
||||
]
|
||||
|
||||
workers=workers.slice(0,N);
|
||||
var t = time();
|
||||
function run1 () {
|
||||
var ready = workers.length;
|
||||
runCount++;
|
||||
workers.forEach(function (url) {
|
||||
if (verbose) log(url+' '+runCount);
|
||||
else if ((runCount % 1000)==1) log(url+' '+runCount);
|
||||
Rpc.trans(url,{
|
||||
command:'sensor',
|
||||
value : Math.random(),
|
||||
})
|
||||
Rpc.trans(url,{
|
||||
command:'step'
|
||||
},function (reply) {
|
||||
if (verbose>1) log(url+inspect(reply))
|
||||
else if ((runCount % 1000)==1) log(url+inspect(reply));
|
||||
if (reply.status) ready--;
|
||||
if (ready==0) {
|
||||
if ((runCount % 1000)==1) {
|
||||
var t1=time()-t;
|
||||
log(t1);
|
||||
t=time();
|
||||
}
|
||||
run1();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
run1()
|
Loading…
Reference in New Issue
Block a user