jam/test/test-singlestep2.js

42 lines
954 B
JavaScript
Raw Normal View History

2024-08-27 00:15:02 +02:00
// 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()