I'd like to measure network latency for SNMP GET request.
There is a free command line tool time which can be used to find timing statistics for various commands. For example it can be used with snmpget in the following way:
$ time snmpget -v 2c -c public 192.168.1.3 .1.3.6.1.2.1.2.2.1.10.2
IF-MIB::ifInOctets.2 = Counter32: 112857973
real 0m0.162s
user 0m0.069s
sys 0m0.005s
According to the manual, statistics conists of:
the elapsed real time between invocation and termination,
the user CPU time (the sum of the
tms_utime and tms_cutime values in a struct tms as returned by
times(2)),the system CPU time (the sum of the
tms_stime and tms_cstime values in a struct tms as returned by
times(2)).
As you see, none of these options allows to measure real network latency time (with excluded other program execution time stats). Is there any way to do so? Maybe not using time tool, but rather some kernel hacks?
I wanted to ask, before I'll start to write my own program.
Thanks, Piotr