开发者

Is it possible to detect the time difference between the moment an epoll is generated by the kernel and the moment the Sun JVM reads it?

i.e. Time A = voltage hits the NIC; Time B = Selector from开发者_如何学编程 Java NIO package is able to select socket channel for I/O.


Use SO_TIMESTAMP and find a NIC that actually supports timestamps and one that supports timestamps with better than millisecond resolution. Then you should have a chance if you can get Java to read incoming cmsg ancillary data.

Without good hardware support the packets are going to be tagged by the kernel with most likely a low resolution unstable timer.

(edit #1) Example code in C requiring 2.6.30 or newer kernel I think:

http://www.mjmwired.net/kernel/Documentation/networking/timestamping/timestamping.c

(edit #2) Example code to determine kernel to user-space latency in C:

http://vilimpoc.org/research/ku-latency/

(edit #3) I recommend following the J-OWAMP project which is dependent upon high resolution timers and packet latency testing. The OWAMP team have been pushing the Linux kernel team for better SO_TIMESTAMP support.

http://www.av.it.pt/jowamp/


you'll need to use something like tcpdump and then correlate timestamps between your application logs and the "sniffer" logs to determine this, it's not possible from the jvm alone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜