#!/usr/sbin/dtrace -s /* * Measure the amount of time required to open a connection with a remote host, * i.e. the time between sending a SYN and receiving a SYN|ACK from the host. */ tcp:::connect-request { start[args[1]->cs_cid] = timestamp; } tcp:::connect-established /start[args[1]->cs_cid]/ { @latency["Connect Latency (ns)", args[2]->ip_daddr] = quantize(timestamp - start[args[1]->cs_cid]); start[args[1]->cs_cid] = 0; }