Add Integer and Long tracepoint types to the Java interface
[lttng-ust.git] / liblttng-ust-java / LTTngUst.java
index 68ed120c1bddf3141989f154dfda2c7d786d093c..f4bea3242b5934a47596915120bc373b429978dd 100644 (file)
@@ -1,5 +1,6 @@
-/*
+/**
  * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2012 Alexandre Montplaisir <alexandre.montplaisir@polymtl.ca>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 
 package org.lttng.ust;
 
-public class LTTngUst {
-       public static native void tracepointString(String name, String arg);
-       static {
-               System.loadLibrary("lttng-ust-java");
-       }
+/**
+ * This class implements the the Java side of the LTTng-UST Java interface.
+ *
+ * First, make sure you have installed "liblttng-ust-java.so" where the linker
+ * can find it. You can then call LTTngUst.init() from your Java program to
+ * connect the methods exposed here to the native library.
+ *
+ * Because of limitations in the probe declaration, all trace events generated
+ * by this library will have "lttng_ust_java" for domain, and "<type>_event" for
+ * event name in the CTF trace files. The "name" parameter will instead appear
+ * as the first element of the event's payload.
+ *
+ * @author Mathieu Desnoyers
+ * @author Alexandre Montplaisir
+ *
+ */
+public abstract class LTTngUst {
+
+    /**
+     * Initialize the UST tracer. This should always be called first, before any
+     * tracepoint* method.
+     */
+    public static void init() {
+        System.loadLibrary("lttng-ust-java"); //$NON-NLS-1$
+    }
+
+    /**
+     * Insert a tracepoint with a payload of type Integer.
+     *
+     * @param name
+     *            The name assigned to this event. For best performance, this
+     *            should be a statically-defined String, or a literal.
+     * @param payload
+     *            The int payload
+     */
+    public static native void tracepointInt(String name, int payload);
+
+    /**
+     * Insert a tracepoint with a payload of type Long
+     *
+     * @param name
+     *            The name assigned to this event. For best performance, this
+     *            should be a statically-defined String, or a literal.
+     * @param payload
+     *            The long payload
+     */
+    public static native void tracepointLong(String name, long payload);
+
+    /**
+     * Insert a tracepoint with a String payload.
+     *
+     * @param name
+     *            The name assigned to this event. For best performance, this
+     *            should be a statically-defined String, or a literal.
+     * @param payload
+     *            The String payload
+     */
+    public static native void tracepointString(String name, String payload);
+
 }
 
This page took 0.024548 seconds and 4 git commands to generate.