Martin Vajnar [Sat, 2 May 2015 13:24:55 +0000 (15:24 +0200)]
JORTE: document hack that 'bypasses' erratic bug in liborte
The recvCallBack() could sometimes be invoked even after subscription's
destruction. In order to avoid dereferencing pointer to free()'d memory we
use this 'intermediary' pointer and during subscription destruction we
set it to null and test this value in recvCallBack().
Martin Vajnar [Sat, 2 May 2015 12:36:28 +0000 (14:36 +0200)]
JORTE: move common stuff to getString() function
Create getString() function, that first determines size of char pointer,
then fetches the appropriate number of bytes from the helper buffer and
stores them in an appropriate Java primitive data type. When the pointer
is retrieved native get_string() function is passed the pointer and
it returns Java String object encapsulating the requested C string.
Martin Vajnar [Sat, 2 May 2015 12:22:21 +0000 (14:22 +0200)]
JORTE: make helper buffer static
helper_buffer carries always the same information on a given platform, so
it can be moved to static constructor, where it is initialized only once
during class loading.
Martin Vajnar [Mon, 20 Apr 2015 17:55:29 +0000 (19:55 +0200)]
Java: rewrite receive callback
This commit results in significant increase of subscriber's performance
in Java.
Previously we used to create many Java objects during the reception of fresh
issue. These objects carried the same information as the ORTERecvInfo C
structure. Now we handle it in a way similar to how data reception is taken
care of.
That is, we allocate a direct ByteBuffer upon the creation of subscriber.
This buffer's address is then stored in a helper structure, which is passed
to this receive callback function.
When new issue arrives, we copy it's ORTERecvInfo C structure into this
ByteBuffer by calling memcpy(). We are not immediately parsing the contents
of this buffer for performance reasons. We do it only when someone
requests information included in the buffer (this is handled in the
org.ocera.orte.types.RecvInfo class).
Many method IDs and field IDs previously looked-up upon every callback
invocation are now cached in a helper structure, since the IDs remain
valid until the mentioned classes are unloaded by the ClassLoader
(that is until all their instances are GC'd). Also many unnecessary checks
are removed from the receive callback. This patch increases the probability,
that the callback function remains in the I-cache, because many procedures
are moved away.
Performance comparison before and after applying this patch:
(Reception of 10,000 issues)
PC, Intel C2Q Q9550 @ 2GHz, OpenJDK 7
Before: 2.01 s
Now: 1.68 s
SE Xperia Ray, Android 4.1
Before (Thumb): 10.95 s
Before (ARM): 10.90 s
Now (Thumb): 9.43 s
Now (ARM): 9.53 s
As could be seen the Thumb-2 mode outperforms the ARM mode, so there is now
no need to switch to the ARM mode.
Michal Sojka [Sat, 14 Mar 2015 15:39:35 +0000 (16:39 +0100)]
Use CLOCK_MONOTONIC rather than CLOCK_REALTIME
This changes the clock used internally by ORTE for timestamps in the
protocol and for timing of internal operations. Previously,
CLOCK_REALTIME was used, probably because it is the default clock used
by pthread_cond_timedwait(). Using CLOCK_REALTIME has the disadvantage
that the time can "jump", e.g. when the clock is adjusted by ntpdate.
This causes the applications to stop publishing, which results in them
disappearing from the domain even through their processes still run.
The solution implemented in this commit is to switch the clock to
CLOCK_MONOTONIC, which does not jump. This should have no effect at the
protocol level, because the semantic of timestamps is not defined in the
spec. This was also tested by running the implementations with and
without this change against each other.
In future, it might be a good idea to use different clocks for
timestamps in the protocol and for timing of internal operations (e.g.
ORTEAppSendThread()). I'm not sure what happens in the following two
cases:
1) When one node is suspended to RAM/disk, CLOCK_MONOTONIC stops for the
time of suspension and it is not clear to me what other nodes that
run continuously do when the suspended node resumes.
2) When a node is rebooted, the monotonic clock starts from zero, i.e.
there is a "jump". I'm not sure, whether IDs of the application
before and after reboot will be different. UDP ports, that are a part
of the ID should be randomized, but the question is how good this
randomization is. If the ID is the same before and after reboot some
problems might also appear.
jiri hubacek [Sat, 31 Jan 2015 19:51:17 +0000 (20:51 +0100)]
Simplified approach to write application.
- no need for fragments
- no need for complex approach to backward compatibility
- usable drawables choosen
- cs language added
- help added
- settings added
Michal Sojka [Sat, 7 Feb 2015 12:21:22 +0000 (13:21 +0100)]
Add configuration for uncrustify
The formatting of ORTE source code is messy. To unify the formatting at
least a bit, we will use the uncrustify tool. This commit adds
uncrustify configuration tuned for ORTE sources and a helper script that
call uncrustify on all relevant files.
Michal Sojka [Fri, 16 Jan 2015 12:10:13 +0000 (13:10 +0100)]
Remove useless condition
I did small investigation whether the second condition should compare
something else or not and it seems that no other comparison is necessary.
Therefore I believe that removing this rather than changing it to something
else is the correct thing to do.
Martin Vajnar [Tue, 8 Apr 2014 08:51:27 +0000 (10:51 +0200)]
JORTE: fix bug in subscriber callback
This fixes a rarely occurring bug in subscriber callback.
When a Java subscriber is being destroyed, during the process
a JORTECallbackContext_t structure, used for storing pointers to Java objects,
was free()'d. If this occurred when new issue had arrived and was being
processed by the receive thread, then the pointer to the, now non-existent,
callback structure would have been dereferenced, leading to a SEGFAULT.
To fix this we now create a pointer to pointer to the specific structure
and pass this pointer to ORTESubcriptionCreate() and use it from the recvCallBack().
Pavel Pisa [Sun, 13 Apr 2014 11:17:08 +0000 (13:17 +0200)]
RTEMS: actual RTEMS git sources do not provide CONFIGURE_NUMBER_OF_DRIVERS define.
There is only one version of table - actual runtime version.
The read-only table with initialization data is not present
and cannot be used for to compute number of entries of config
harcoded drivers set (CONFIGURE_NUMBER_OF_DRIVERS).
Michal Sojka [Sat, 15 Mar 2014 23:48:48 +0000 (00:48 +0100)]
Update versioning of shared libraries
Previously, we used -release to specify the SONAME, which would cause
binary incompatibility between releases even if the library is not
changed at all. Additionally, libtool interface numbers were derived
from relase number in an undocumented way. This is removed as well and
now we have to modify SONAME manually, when the interface changes.
OMK is broken and some things do not work when shared libraries are
created. This has to wait for later. If you need shared library, use
automake-based build.
Pavel Pisa [Thu, 14 Nov 2013 13:02:50 +0000 (14:02 +0100)]
Fix reported problem "compile error on cygwin"
The Windows service support in ORTE manager is enabled
now for Cygwin build as well. Build under MINGW has been
tested but some external volunteer is required for Cygwin
environment test.
Another option is to add config option which allows
to specify if Windows service support should or should not
be build.
Pavel Pisa [Fri, 4 Oct 2013 07:48:27 +0000 (09:48 +0200)]
Omit "byteswap.h" from pre-configured OMK Linux build.
The CDR and rest of the ORTE code uses open-codded ORTE provided
rtps_byteswap function. Build environment provided byteswap
functions are not utilized in the actual ORTE setups.
They could result in better optimized code in future but
attempt to include "byteswap.h" is probably the last blocker
to use Linux pre-configured ORTE on RTEMS, BSD and BlackBerry.
So comment out HAVE_BYTESWAP_H for now.
Pavel Pisa [Mon, 30 Sep 2013 10:02:00 +0000 (12:02 +0200)]
OMK build: move linker specification of pthread library to separate variable TARGET_LOADLIBES.
This allows to override libraries list suitable for the Linux
build by other target OS specific list of the libraries.
I.e. the explicit "pthread" library specification is blocker
for QNX/BlackBerry build because POSIX threads are included
in stadartd library. On the other hand BSD networking "socket"
library has to be specified explicitly. Another difference
is missing "byteswap.h" header file (undef HAVE_BYTESWAP_H).