Measuring Network Latency In Solaris
Use the below dtrace script (SuperPing.d) to measuring Network Latency.
#!/usr/sbin/dtrace -s #pragma D option quiet #pragma D option switchrate=10hz mib:::rawipOutDatagrams /pid == $target/ { start = timestamp; } mib:::icmpInEchoReps /start/ { this->delta = (timestamp - start) / 1000; printf("dtrace measured: %d us\n", this->delta); @a["\n ICMP packet delta average (us):"] = avg(this->delta); @q["\n ICMP packet delta distribution (us):"] = lquantize(this->delta, 0, 1000000, 100); start = 0; }
Run it like the below.
./superping.d -c "ping -s 10.151.19.10" ctr ^c - to stop
Sample output.
----10.151.19.10 PING Statistics---- 62 packets transmitted, 62 packets received, 0% packet loss dtrace measured: 410 us ICMP packet delta average (us): 430 ICMP packet delta distribution (us): value ------------- Distribution ------------- count 200 | 0 300 |@@@@@@@@ 12 400 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 48 500 |@ 1 600 |@ 1 700 | 0 round-trip (ms) min/avg/max/stddev = 0.748/0.850/1.076/0.049