Paul G. Allen wrote:
I've written a rather large Java application for my company. It uses MySQL and serial communications. Part of the application loads firmware from a file on the PC into an embedded device over the serial ports. It can support as many serial ports as the computer can support (currently I've used it with 10). It runs a separate thread for each port. It runs on Linux (specifically, I'm using FC4). The MySQL database is on a server.

The portion of the code used for doing the serial port communication was taken from another application that performs a similar task. This other application only supports a single serial port and only runs on Windows.

It seems the other application can load the firmware in a fraction of the time that mine can, but the code is the same. I haven't yet been able to try my code on a Windows box that works to see if it'll run faster. I'm wondering if a Java on Linux might be slower than Java on Windows? I'm also wondering if there is a JIT compiler in existence that I can use to compile the Java app. into native code for Linux (there are many for Windows). The JIT would have to support Sun Java 1.5. (Note: Seems I can't find HotSpot for Java 1.5)

It also seems that my application takes far longer than it should to load firmware depending upon the number of devices connected: loading 203KB at 115,200 on a single device takes 15 minutes, 10 devices takes 20 minutes).

I think you need to break up the problem a bit. First off would be check what the serial port speed is set to when you start and when you finish. The default serial port settings might be 9600-8-N-1 instead of the 115200 you think it is. I'm not even sure Java is allowed to change the serial port settings without a tweak to the security manager.

Have you tried checking/setting the port speeds using something like setserial before running your program?

Why not write a small test program that just reads the firmware file from disk and dumps to null first, make sure that works, then write to the serial port. That way you can check that that is really the problem to begin with. It might turn out that you have too many threads running and a synchronize problem instead.

Gus


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to