| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-only |
| 3 | * |
| 4 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | * Copyright (C) 2012 Alexandre Montplaisir <alexandre.montplaisir@polymtl.ca> |
| 6 | */ |
| 7 | |
| 8 | package org.lttng.ust; |
| 9 | |
| 10 | /** |
| 11 | * This class implements the the Java side of the LTTng-UST Java interface. |
| 12 | * |
| 13 | * First, make sure you have installed "liblttng-ust-java.so" where the linker |
| 14 | * can find it. You can then call LTTngUst.init() from your Java program to |
| 15 | * connect the methods exposed here to the native library. |
| 16 | * |
| 17 | * Because of limitations in the probe declaration, all trace events generated |
| 18 | * by this library will have "lttng_ust_java" for domain, and "<type>_event" for |
| 19 | * event name in the CTF trace files. The "name" parameter will instead appear |
| 20 | * as the first element of the event's payload. |
| 21 | * |
| 22 | * @author Mathieu Desnoyers |
| 23 | * @author Alexandre Montplaisir |
| 24 | * |
| 25 | */ |
| 26 | public abstract class LTTngUst { |
| 27 | |
| 28 | /** |
| 29 | * Initialize the UST tracer. This should always be called first, before any |
| 30 | * tracepoint* method. |
| 31 | */ |
| 32 | public static void init() { |
| 33 | System.loadLibrary("lttng-ust-java"); //$NON-NLS-1$ |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Insert a tracepoint with a payload of type Integer. |
| 38 | * |
| 39 | * @param name |
| 40 | * The name assigned to this event. For best performance, this |
| 41 | * should be a statically-defined String, or a literal. |
| 42 | * @param payload |
| 43 | * The int payload |
| 44 | */ |
| 45 | public static native void tracepointInt(String name, int payload); |
| 46 | |
| 47 | /** |
| 48 | * Insert a tracepoint with a payload consisting of two integers. |
| 49 | * |
| 50 | * @param name |
| 51 | * The name assigned to this event. For best performance, this |
| 52 | * should be a statically-defined String, or a literal. |
| 53 | * @param payload1 |
| 54 | * The first int payload |
| 55 | * @param payload2 |
| 56 | * The second int payload |
| 57 | */ |
| 58 | public static native void |
| 59 | tracepointIntInt(String name, int payload1, int payload2); |
| 60 | |
| 61 | /** |
| 62 | * Insert a tracepoint with a payload of type Long |
| 63 | * |
| 64 | * @param name |
| 65 | * The name assigned to this event. For best performance, this |
| 66 | * should be a statically-defined String, or a literal. |
| 67 | * @param payload |
| 68 | * The long payload |
| 69 | */ |
| 70 | public static native void tracepointLong(String name, long payload); |
| 71 | |
| 72 | /** |
| 73 | * Insert a tracepoint with a payload consisting of two longs. |
| 74 | * |
| 75 | * @param name |
| 76 | * The name assigned to this event. For best performance, this |
| 77 | * should be a statically-defined String, or a literal. |
| 78 | * @param payload1 |
| 79 | * The first long payload |
| 80 | * @param payload2 |
| 81 | * The second long payload |
| 82 | */ |
| 83 | public static native void |
| 84 | tracepointLongLong(String name, long payload1, long payload2); |
| 85 | |
| 86 | /** |
| 87 | * Insert a tracepoint with a String payload. |
| 88 | * |
| 89 | * @param name |
| 90 | * The name assigned to this event. For best performance, this |
| 91 | * should be a statically-defined String, or a literal. |
| 92 | * @param payload |
| 93 | * The String payload |
| 94 | */ |
| 95 | public static native void tracepointString(String name, String payload); |
| 96 | |
| 97 | } |
| 98 | |