If you want to evaluate performance, I'd suggest mapping a simple
function close to a no-op (atoi, floor, or some such function) and see
if you can invoke it from Java sufficiently fast for your purposes, in
the way you would call your serial port functions.
If RXTX is too slow, it's not likely JNA would be faster (they're both
using JNI) unless you fundamentally change how you're interacting with
the serial port (which may be the case if you're tweaking tty settings
directly). Ideally you'd have a fairly large buffer which can be
filled automatically; character-by-character reading would likely
incur too much overhead if you have to cross the VM/native bridge on
every one.
On Mar 11, 2008, at 4:47 PM, zamek wrote:
hi,
Ezzel a dátummal: Tuesday 11 March 2008 20.25.13 Marc Ravensbergen
ezt írta:
Hi, any reason you wouldn't use something like rxtx, which is
basically
serial communications for java?
I need to communicate a microcontroller based device which send/
receive 96
bytes packages with 921kb/sec at every 5mS. All are ok, but there is
an 5 mS
latency between the first character of package and data_available
signal.
I tested it with an oscilloscope, first channel was in Rxd, and
second channel
in RTS. When I got data available signal I set/reset rts. This
latency was
5-25mS, but if I tried Molnar Ingo's reat time linux patch, it
stabilized to
5mS. And when I tried it in native c based on
http://www.comptechdoc.org/os/linux/programming/c/linux_pgcserial.html
this latency reduced to 50uS!
I would like to test it with jna.