#sleela 2.1 // synchro_measure.sleela -- Synchro honest packet dispatch + measurement, // first-class in the Sleela source language (syntax 1.3). Synchro measures // what actually happened; it makes no delivery-time guarantee. A dispatch to a // dark port is honest loss, and the stats never fabricate a latency. class SynchroMeasure { void main() { int probe = synchroOpen("127.0.0.1", 9); // loopback discard: dark UDP print("probe handle >= 0 : " + (probe >= 0)); if (probe >= 0) { // One dispatch with a 50ms budget. Returns the measured RTT in // microseconds, or -1 on honest loss/timeout. int rtt = synchroDispatch(probe, 32, 50); print("sent=" + synchroSent(probe) + " received=" + synchroReceived(probe) + " loss(permille)=" + synchroLoss(probe)); // mean/p95 are -1 when nothing was received (no fabrication). print("mean(us)=" + synchroMean(probe) + " p95(us)=" + synchroP95(probe)); print(synchroReport(probe)); synchroClose(probe); } } }