[Cluster-devel] [PATCH/RFC] java: add initial bindings

Alexander Aring aahringo at redhat.com
Wed Jul 13 13:40:28 UTC 2022


Hi,

On Fri, Jul 8, 2022 at 2:31 PM Steven Rostedt <rostedt at goodmis.org> wrote:
>
> On Mon, 20 Jun 2022 16:45:39 -0400
> Alexander Aring <aahringo at redhat.com> wrote:
>
> Hi Alexander!
>
>
> > This patch adds basic java bindings for libtracecmd. It currently
> > supports very basic handling of parsing trace-cmd recorded trace files.
> > There might of course additional improvements regarding swig bindings and
> > the memory handling. E.g. in javas builtin iterator for-each handling
> > everything will keep in memory. The license for the high-level java
> > bindings jar file is LGPL-2.1 and is the same as libtracecmd.
> >
> > The author of this patch created a java application that uses those java
> > bindings to trace locks and represent them in graphical GANTT diagram,
> > see [0].
> >
> > You need to set the JAVA_HOME environment variable to let the Makefile know
> > that it builds the java bindings. This is somehow standard in the java world
> > as replacement for pkg-config or similar. There should no trace-cmd java
> > dependency, the recommended way should be to provide a kind of trace-cmd-java
> > package from your distribution containing the tracecmd.jar and
> > libctracecmdjava.so. This package would have then a java dependency to
> > e.g. OpenJDK, that I was using to test those bindings for.
> >
> > The author is not a swig expert but it works as it currently is. Also
> > the author did not hit issues because memory _yet_. Those are beginning
> > experimental bindings and can be changed/improved in future.
>
>
> Are you "the author"?
>

yes.

> Could you rephrase this better?
>
> Like:
>
> "There may be better ways to do this with swig, but this appears to work as
> is, as there were no issues because of memory _yet_."
>
> That is, please try to rewrite the change log without referring to yourself.
>

okay.

> >
> > [0] https://gitlab.com/netcoder/dlm2slog2
> > Signed-off-by: Alexander Aring <aahringo at redhat.com>
> > ---
> >  .gitignore                        |   4 +
> >  Makefile                          |  60 ++++++-
> >  java/Makefile                     |  39 +++++
> >  java/TraceCmd.java                | 236 +++++++++++++++++++++++++
> >  java/TraceCmdEvent.java           | 277 ++++++++++++++++++++++++++++++
> >  java/TraceCmdException.java       |  16 ++
> >  java/TraceCmdField.java           | 104 +++++++++++
> >  java/ctracecmdjava.i              | 180 +++++++++++++++++++
> >  java/example/Makefile             |   7 +
> >  java/example/TraceCmdExample.java |  33 ++++
> >  10 files changed, 953 insertions(+), 3 deletions(-)
> >  create mode 100644 java/Makefile
> >  create mode 100644 java/TraceCmd.java
> >  create mode 100644 java/TraceCmdEvent.java
> >  create mode 100644 java/TraceCmdException.java
> >  create mode 100644 java/TraceCmdField.java
> >  create mode 100644 java/ctracecmdjava.i
> >  create mode 100644 java/example/Makefile
> >  create mode 100644 java/example/TraceCmdExample.java
> >
>
> I'm not a swig nor Java expert, and will likely not even test this code.
> But I'm happy to include it if it doesn't break anything that I do test.
> But if anyone complains of breakage, I'll simply point them to you ;-)
>
> Are you OK with that?
>
> Hmm, I should add a MAINTAINERS file to add people that support different
> portions of trace-cmd.
>

I already created a new project trace-cmd-java [0]. This will static
link against libtracecmd and their dependencies. At the end it
produces a binary blob for the java bindings. The advantage here is
that I have full control over the used version of libtracecmd and
their dependencies.

I would like to go this way and see how it goes. Meanwhile I can do
more testing and cleanups. I may come back again to bring it upstream.

- Alex

[0] https://gitlab.com/netcoder/trace-cmd-java



More information about the Cluster-devel mailing list