Context
Current status
For performance analysis, my company is interested in nanosecond resolution. So far, we have been using hardware timestamps and the support of nanoseconds was quickly hacked into the C libpcap library.
It seems that the support for nanoseconds has now been added to the library (see other Stack Overflow answer here), and the last version on the git repository makes the following method available:
pcap_open_offline_with_tstamp_precision(pathname, PCAP_TSTAMP_PRECISION_NANO, errbuf);
Future
The thing is, C has proven itself to be hardly maintainable, difficultly scalable and since we use the capture for analysis only, we feel like we could benefit from using Java instead. Being able to use a proper IDE, Maven, build web-services, etc. seems more important than speed of execution when it comes to performance analysis.
I first hoped to be able to use jNetPcap but I can't find out how to support nanosecond resolution with that Java binding of libpcap.
Question
jNetPcap
Does anyone know an easy way to read Pcap files with nanosecond precision, using jNetPcap?
Update: I just found mention of a TimestampResolution
enum in jNetPcap's Javadoc. I will try to use that and update my answer later.
Note: I have also asked about nanosecond resolution directly on jNetPcap's support forum, and will update my question if I get any answer on that side...
Other solutions
Does anyone know about another way to profit from Java's ecosystem while still being able to read PCap files with nanosecond precision?
Thanks! :)
System.nanoTime()
what you are searching? – hgoeblSystem.nanoTime()
will give the value of the most precise available timer. It only allows for performance analysis within a given Java program. Read the rest of the post: in my case, I have hardware timestamp in a PCAP file, and I want to calculate latencies a posteriori – snooze92