Mathieu Desnoyers | 30 Jun 01:02 2015

Re: [PATCH urcu v2] tests: Convert unit tests to TAP

It fails out of tree make check.

----- On Jun 29, 2015, at 6:53 PM, Michael Jeanson mjeanson <at> efficios.com wrote:

> Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
> ---
> .gitignore                         |   2 +
> configure.ac                       |   1 +
> tests/Makefile.am                  |   2 +-
> tests/unit/Makefile.am             |  15 +-
> tests/unit/run.sh                  |  22 ++
> tests/unit/test_loop               |  12 +
> tests/unit/test_uatomic.c          |  76 +++++--
> tests/unit/test_urcu_multiflavor.c |  28 +--
> tests/unit/unit_tests              |   3 +
> tests/utils/Makefile.am            |   3 +
> tests/utils/tap.c                  | 433 +++++++++++++++++++++++++++++++++++
> tests/utils/tap.h                  |  89 ++++++++
> tests/utils/tap.sh                 | 456 +++++++++++++++++++++++++++++++++++++
> 13 files changed, 1091 insertions(+), 51 deletions(-)
> create mode 100755 tests/unit/run.sh
> create mode 100755 tests/unit/test_loop
> create mode 100644 tests/unit/unit_tests
> create mode 100644 tests/utils/Makefile.am
> create mode 100644 tests/utils/tap.c
> create mode 100644 tests/utils/tap.h
> create mode 100755 tests/utils/tap.sh
> 
> diff --git a/.gitignore b/.gitignore
> index 7b6704b..58e88f6 100644
(Continue reading)

Mathieu Desnoyers | 30 Jun 00:56 2015

[PATCH] Fix: call_rcu_thread() affinity failure

Make call_rcu_thread() affine itself more persistently

Currently, URCU simply fails if a call_rcu_thread() fails to affine
itself. This is problematic when execution is constrained by cgroup
and hotunplugged CPUs. This commit therefore makes call_rcu_thread()
retry setting its affinity every 256 grace periods, but only if it
detects that it migrated to a different CPU. Since sched_getcpu() is
cheap on many architectures, this check is less costly than going
through a system call.

Reported-by: Michael Jeanson <mjeanson <at> efficios.com>
Suggested-by: Paul E. McKenney <paulmck <at> linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers <at> efficios.com>
---
 urcu-call-rcu-impl.h | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h
index 5cc02d9..b82a59b 100644
--- a/urcu-call-rcu-impl.h
+++ b/urcu-call-rcu-impl.h
 <at>  <at>  -45,6 +45,9  <at>  <at> 
 #include "urcu/ref.h"
 #include "urcu-die.h"

+#define SET_AFFINITY_CHECK_PERIOD		(1U << 8)	/* 256 */
+#define SET_AFFINITY_CHECK_PERIOD_MASK		(SET_AFFINITY_CHECK_PERIOD - 1)
+
 /* Data structure that identifies a call_rcu thread. */

(Continue reading)

Daniel Olivier | 29 Jun 21:52 2015
Picon

Compilation error in lttng-tools (version.c)

I am getting:

make[3]: Entering directory `/root/trace_ea/foss/lttng-tools/src/bin/lttng'
depbase=`echo commands/version.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        gcc -DHAVE_CONFIG_H -I../../.. -I../../.. -I../../../src -I../../../include -include config.h 
-I../../../include -I../../../src -DINSTALL_BIN_PATH=\""/usr/local/bin"\"   -Wall -g -O2 -g
-fno-strict-aliasing -MT commands/version.o -MD -MP -MF $depbase.Tpo -c -o commands/version.o
commands/version.c &&\
        mv -f $depbase.Tpo $depbase.Po
commands/version.c: In function 'create_version':
commands/version.c:71: error: 'PACKAGE_URL' undeclared (first use in this function)
commands/version.c:71: error: (Each undeclared identifier is reported only once
commands/version.c:71: error: for each function it appears in.)
make[3]: *** [commands/version.o] Error 1

I gather that PACKAGE_URL should get generated by configure step into config.h (or something)...

Attached is config.log, but I didn't find that it contained any errors pertaining to this.

Anybody ever see this?

Thanks,
Daniel

Attachment (config.log): application/octet-stream, 180 KiB
_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
(Continue reading)

Aravind HT | 29 Jun 20:21 2015
Picon

Valgrind Memory Error in lttng-relayd

Hi,

I ran valgrind on lttng-relayd for a soft hang issue that I had reported earlier.

Below are the list of errors that I found.

==793== Thread 4:
==793== Invalid write of size 8
==793==    at 0x406038: cds_list_add (list.h:53)
==793==    by 0x409442: queue_stream (main.c:1175)
==793==    by 0x409AB7: relay_add_stream (main.c:1274)
==793==    by 0x40C47A: relay_process_control (main.c:2099)
==793==    by 0x40DBB1: relay_thread_worker (main.c:2574)
==793==    by 0x5BDAFE2: start_thread (pthread_create.c:312)
==793==    by 0x5ED8AFC: clone (clone.S:111)
==793==  Address 0x6e09040 is 64 bytes inside a block of size 312 free'd
==793==    at 0x4C2898C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==793==    by 0x418EF8: rcu_destroy_stream (stream.c:33)
==793==    by 0x5079C94: ??? (in /usr/lib64/liburcu.so.2.0.0)
==793==    by 0x5BDAFE2: start_thread (pthread_create.c:312)
==793==    by 0x5ED8AFC: clone (clone.S:111)
==793==

Are there any known bugs/fixes for these ?


Regards,
Aravind.

_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
jamie explorer | 29 Jun 19:03 2015
Picon

application changes to support lttng

Hello,

I have just started using lttng and still looking at documentation.
Can you help me with some info.

How does the app register to use lttng?
how do sessiond, app and lttng-ust interact? is there any socket from every app to sessiond?
How is the app modified when instrumented using lttng? are there any threads added?
when lttng instrumentation is linked along with app
Are there any powerful tools for analysis on collected traces.

/Jam 
_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Alexandre Montplaisir | 27 Jun 00:03 2015

[PATCH lttng-ust] Fix compiliation warnings

Remove unused imports.
Access static fields statically.

Signed-off-by: Alexandre Montplaisir <alexmonthy <at> efficios.com>
---
 .../java/org/lttng/ust/agent/LTTngAgent.java       | 99 ++++++++++------------
 .../org/lttng/ust/agent/LTTngSessiondCmd2_6.java   |  4 +-
 .../lttng/ust/agent/LTTngTCPSessiondClient.java    | 29 +++----
 .../java/org/lttng/ust/agent/log4j/LTTngLog4j.java |  2 +-
 4 files changed, 59 insertions(+), 75 deletions(-)

diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngAgent.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngAgent.java
index f7e1e38..066966f 100644
--- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngAgent.java
+++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngAgent.java
 <at>  <at>  -17,19 +17,10  <at>  <at> 

 package org.lttng.ust.agent;

-import org.lttng.ust.agent.jul.LTTngJUL;
-
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.BufferedReader;
-import java.io.FileReader;
+import java.lang.reflect.InvocationTargetException;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
-import java.util.Enumeration;
-import java.lang.reflect.InvocationTargetException;
-
-import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;

 public class LTTngAgent {
 	/* Domains */
 <at>  <at>  -87,7 +78,7  <at>  <at>  public class LTTngAgent {
 			initAgentLog4jClasses();
 		}

-		this.registerSem = new Semaphore(0, true);
+		registerSem = new Semaphore(0, true);
 	}

 	private Boolean loadLog4jClasses() {
 <at>  <at>  -151,8 +142,8  <at>  <at>  public class LTTngAgent {
 	private void initAgentJULClasses() {
 		try {
 			Class<?> lttngJUL = loadClass("org.lttng.ust.agent.jul.LTTngJUL");
-			this.julUser = (LogFramework)lttngJUL.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(false);
-			this.julRoot = (LogFramework)lttngJUL.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(true);
+			julUser = (LogFramework)lttngJUL.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(false);
+			julRoot = (LogFramework)lttngJUL.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(true);
 			this.useJUL = true;
 		} catch (ClassNotFoundException e) {
 			/* LTTng JUL classes not found, no need to create the relevant objects */
 <at>  <at>  -171,8 +162,8  <at>  <at>  public class LTTngAgent {
 	private void initAgentLog4jClasses() {
 		try {
 			Class<?> lttngLog4j = loadClass("org.lttng.ust.agent.log4j.LTTngLog4j");
-			this.log4jUser = (LogFramework)lttngLog4j.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(false);
-			this.log4jRoot = (LogFramework)lttngLog4j.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(true);
+			log4jUser = (LogFramework)lttngLog4j.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(false);
+			log4jRoot = (LogFramework)lttngLog4j.getDeclaredConstructor(new Class[] {Boolean.class}).newInstance(true);
 			this.useLog4j = true;
 		} catch (ClassNotFoundException e) {
 			/* LTTng Log4j classes not found, no need to create the relevant objects */
 <at>  <at>  -201,7 +192,7  <at>  <at>  public class LTTngAgent {
 	}

 	private synchronized void init() throws SecurityException, IOException {
-		if (this.initialized) {
+		if (initialized) {
 			return;
 		}

 <at>  <at>  -220,38 +211,38  <at>  <at>  public class LTTngAgent {

 		/* Wait for each registration to end. */
 		try {
-			this.registerSem.tryAcquire(numThreads,
+			registerSem.tryAcquire(numThreads,
 						    semTimeout,
 						    TimeUnit.SECONDS);
 		} catch (InterruptedException e) {
 			e.printStackTrace();
 		}

-		this.initialized = true;
+		initialized = true;
 	}

 	private synchronized Integer initJULClientThreads() {
 		Integer numThreads = 2;

 		/* Handle user session daemon if any. */
-		this.julUserClient = new LTTngTCPSessiondClient(Domain.JUL,
-								this.julUser,
-								this.registerSem);
+		julUserClient = new LTTngTCPSessiondClient(Domain.JUL,
+								julUser,
+								registerSem);

 		String userThreadName = "LTTng UST agent JUL user thread";
-		this.sessiondThreadJULUser = new Thread(julUserClient, userThreadName);
-		this.sessiondThreadJULUser.setDaemon(true);
-		this.sessiondThreadJULUser.start();
+		sessiondThreadJULUser = new Thread(julUserClient, userThreadName);
+		sessiondThreadJULUser.setDaemon(true);
+		sessiondThreadJULUser.start();

 		/* Handle root session daemon. */
-		this.julRootClient = new LTTngTCPSessiondClient(Domain.JUL,
-								this.julRoot,
-								this.registerSem);
+		julRootClient = new LTTngTCPSessiondClient(Domain.JUL,
+								julRoot,
+								registerSem);

 		String rootThreadName = "LTTng UST agent JUL root thread";
-		this.sessiondThreadJULRoot = new Thread(julRootClient, rootThreadName);
-		this.sessiondThreadJULRoot.setDaemon(true);
-		this.sessiondThreadJULRoot.start();
+		sessiondThreadJULRoot = new Thread(julRootClient, rootThreadName);
+		sessiondThreadJULRoot.setDaemon(true);
+		sessiondThreadJULRoot.start();

 		return numThreads;
 	}
 <at>  <at>  -259,23 +250,23  <at>  <at>  public class LTTngAgent {
 	private synchronized Integer initLog4jClientThreads() {
 		Integer numThreads = 2;

-		this.log4jUserClient = new LTTngTCPSessiondClient(Domain.LOG4J,
-								  this.log4jUser,
-								  this.registerSem);
+		log4jUserClient = new LTTngTCPSessiondClient(Domain.LOG4J,
+								  log4jUser,
+								  registerSem);

 		String userThreadName = "LTTng UST agent Log4j user thread";
-		this.sessiondThreadLog4jUser = new Thread(log4jUserClient, userThreadName);
-		this.sessiondThreadLog4jUser.setDaemon(true);
-		this.sessiondThreadLog4jUser.start();
+		sessiondThreadLog4jUser = new Thread(log4jUserClient, userThreadName);
+		sessiondThreadLog4jUser.setDaemon(true);
+		sessiondThreadLog4jUser.start();

-		this.log4jRootClient = new LTTngTCPSessiondClient(Domain.LOG4J,
-								  this.log4jRoot,
-								  this.registerSem);
+		log4jRootClient = new LTTngTCPSessiondClient(Domain.LOG4J,
+								  log4jRoot,
+								  registerSem);

 		String rootThreadName = "LTTng UST agent Log4j root thread";
-		this.sessiondThreadLog4jRoot = new Thread(log4jRootClient,rootThreadName);
-		this.sessiondThreadLog4jRoot.setDaemon(true);
-		this.sessiondThreadLog4jRoot.start();
+		sessiondThreadLog4jRoot = new Thread(log4jRootClient,rootThreadName);
+		sessiondThreadLog4jRoot.setDaemon(true);
+		sessiondThreadLog4jRoot.start();

 		return numThreads;
 	}
 <at>  <at>  -283,28 +274,28  <at>  <at>  public class LTTngAgent {

 	public void dispose() throws IOException {
 		if (this.useJUL) {
-			this.julUserClient.destroy();
-			this.julRootClient.destroy();
-			this.julUser.reset();
-			this.julRoot.reset();
+			julUserClient.destroy();
+			julRootClient.destroy();
+			julUser.reset();
+			julRoot.reset();
 		}

 		if (this.useLog4j) {
-			this.log4jUserClient.destroy();
-			this.log4jRootClient.destroy();
-			this.log4jUser.reset();
-			this.log4jRoot.reset();
+			log4jUserClient.destroy();
+			log4jRootClient.destroy();
+			log4jUser.reset();
+			log4jRoot.reset();
 		}

 		try {
 			if (this.useJUL) {
-				this.sessiondThreadJULUser.join();
-				this.sessiondThreadJULRoot.join();
+				sessiondThreadJULUser.join();
+				sessiondThreadJULRoot.join();
 			}

 			if (this.useLog4j) {
-				this.sessiondThreadLog4jUser.join();
-				this.sessiondThreadLog4jRoot.join();
+				sessiondThreadLog4jUser.join();
+				sessiondThreadLog4jRoot.join();
 			}

 		} catch (InterruptedException e) {
diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngSessiondCmd2_6.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngSessiondCmd2_6.java
index c68308e..3497689 100644
--- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngSessiondCmd2_6.java
+++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngSessiondCmd2_6.java
 <at>  <at>  -20,11 +20,9  <at>  <at>  package org.lttng.ust.agent;

 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
-import java.lang.Object;
 import java.util.ArrayList;
-import java.util.List;
-import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.List;

 interface LTTngSessiondCmd2_6 {
 	/**
diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java
index ab800ed..f16743c 100644
--- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java
+++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java
 <at>  <at>  -17,20 +17,18  <at>  <at> 

 package org.lttng.ust.agent;

-import java.util.concurrent.Semaphore;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.lang.Integer;
-import java.io.IOException;
-import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.DataInputStream;
-import java.io.FileReader;
+import java.io.DataOutputStream;
 import java.io.FileNotFoundException;
-import java.net.*;
+import java.io.FileReader;
+import java.io.IOException;
 import java.lang.management.ManagementFactory;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.concurrent.Semaphore;

 class LTTngTCPSessiondClient implements Runnable {

 <at>  <at>  -142,7 +140,7  <at>  <at>  class LTTngTCPSessiondClient implements Runnable {
 	 */
 	private void recvHeader() throws Exception {
 		int read_len;
-		byte data[] = new byte[this.headerCmd.SIZE];
+		byte data[] = new byte[LTTngSessiondCmd2_6.sessiond_hdr.SIZE];

 		read_len = this.inFromSessiond.read(data, 0, data.length);
 		if (read_len != data.length) {
 <at>  <at>  -174,7 +172,6  <at>  <at>  class LTTngTCPSessiondClient implements Runnable {
 	 * Handle session command from the session daemon.
 	 */
 	private void handleSessiondCmd() throws Exception {
-		int ret_code;
 		byte data[] = null;

 		while (true) {
 <at>  <at>  -238,8 +235,6  <at>  <at>  class LTTngTCPSessiondClient implements Runnable {
 					data = new byte[4];
 					ByteBuffer buf = ByteBuffer.wrap(data);
 					buf.order(ByteOrder.BIG_ENDIAN);
-					LTTngSessiondCmd2_6.lttng_agent_ret_code code =
-						LTTngSessiondCmd2_6.lttng_agent_ret_code.CODE_INVALID_CMD;
 					break;
 				}
 			}
 <at>  <at>  -297,7 +292,7  <at>  <at>  class LTTngTCPSessiondClient implements Runnable {
 			}
 		}

-		this.sessiondSock = new Socket(this.sessiondHost, port);
+		this.sessiondSock = new Socket(sessiondHost, port);
 		this.inFromSessiond = new DataInputStream(
 				sessiondSock.getInputStream());
 		this.outToSessiond = new DataOutputStream(
 <at>  <at>  -311,8 +306,8  <at>  <at>  class LTTngTCPSessiondClient implements Runnable {

 		buf.putInt(this.agentDomain.value());
 		buf.putInt(Integer.parseInt(pid));
-		buf.putInt(this.protocolMajorVersion);
-		buf.putInt(this.protocolMinorVersion);
+		buf.putInt(protocolMajorVersion);
+		buf.putInt(protocolMinorVersion);
 		this.outToSessiond.write(data, 0, data.length);
 		this.outToSessiond.flush();
 	}
diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLog4j.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLog4j.java
index 065b163..6e892bc 100644
--- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLog4j.java
+++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLog4j.java
 <at>  <at>  -69,7 +69,7  <at>  <at>  public class LTTngLog4j extends LogFrameworkSkeleton {
 	 <at> Override
 	public Iterator<String> listLoggers() {
 		Vector<String> logs = new Vector<String>();
-		for (Enumeration loggers = LogManager.getCurrentLoggers(); loggers.hasMoreElements(); ) {
+		for (Enumeration<?> loggers = LogManager.getCurrentLoggers(); loggers.hasMoreElements(); ) {
 			Logger logger = (Logger) loggers.nextElement();
 			String name = logger.getName();
 			logs.add(name);
--

-- 
2.1.4
Michael Jeanson | 26 Jun 01:10 2015

[PATCH lttng-ust] Fix: out of tree build of java agents

Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
---
 liblttng-ust-java-agent/jni/jul/Makefile.am   | 2 +-
 liblttng-ust-java-agent/jni/log4j/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/liblttng-ust-java-agent/jni/jul/Makefile.am b/liblttng-ust-java-agent/jni/jul/Makefile.am
index 6c9dc28..d0d6d78 100644
--- a/liblttng-ust-java-agent/jni/jul/Makefile.am
+++ b/liblttng-ust-java-agent/jni/jul/Makefile.am
 <at>  <at>  -1,4 +1,4  <at>  <at> 
-AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include

 lib_LTLIBRARIES = liblttng-ust-jul-jni.la
 liblttng_ust_jul_jni_la_SOURCES = lttng_ust_jul.c \
diff --git a/liblttng-ust-java-agent/jni/log4j/Makefile.am b/liblttng-ust-java-agent/jni/log4j/Makefile.am
index b734bf3..7acbccd 100644
--- a/liblttng-ust-java-agent/jni/log4j/Makefile.am
+++ b/liblttng-ust-java-agent/jni/log4j/Makefile.am
 <at>  <at>  -1,4 +1,4  <at>  <at> 
-AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 lib_LTLIBRARIES = liblttng-ust-log4j-jni.la
 liblttng_ust_log4j_jni_la_SOURCES = lttng_ust_log4j.c \
 				  lttng_ust_log4j.h
--

-- 
1.9.1
Michael Jeanson | 26 Jun 01:00 2015

[PATCH lttng-ust] Fix: Use env CLASSPATH when building log4j example

The location of the log4j jar file is specified during configure with
the CLASSPATH envvar, reuse it when building the example.

Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
---
 doc/examples/java-log4j/Makefile | 10 +++++++---
 doc/examples/java-log4j/run      | 10 +++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/doc/examples/java-log4j/Makefile b/doc/examples/java-log4j/Makefile
index 4b59964..2c629c3 100644
--- a/doc/examples/java-log4j/Makefile
+++ b/doc/examples/java-log4j/Makefile
 <at>  <at>  -20,7 +20,11  <at>  <at>  JFLAGS = -g

 # Default JUL jar name.
 JARFILE=liblttng-ust-agent.jar
-LOG4J=/usr/share/java/log4j.jar
+
+# If system classpath is empty, try to guess log4j location
+ifeq "$(CLASSPATH)" ""
+	CLASSPATH="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
+endif

 # Check if the top level makefile overrides the JUL Jar file name.
 ifneq "$(JAVA_JARFILE_OVERRIDE)" ""
 <at>  <at>  -29,9 +33,9  <at>  <at>  endif

 # Check if the top level makefile overrides the JUL classpath.
 ifeq "$(JAVA_CLASSPATH_OVERRIDE)" ""
-	CLASSPATH=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE):$(LOG4J)
+	CLASSPATH:=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE):$(CLASSPATH)
 else
-	CLASSPATH=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE):$(LOG4J)
+	CLASSPATH:=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE):$(CLASSPATH)
 endif

 JC = javac -classpath "$(CLASSPATH):."
diff --git a/doc/examples/java-log4j/run b/doc/examples/java-log4j/run
index 5e3cbeb..9dca608 100755
--- a/doc/examples/java-log4j/run
+++ b/doc/examples/java-log4j/run
 <at>  <at>  -8,15 +8,19  <at>  <at> 

 DIR=`dirname $0`
 JARFILE="liblttng-ust-agent.jar"
-LOG4J="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
+
+# If system classpath is empty, try to guess log4j location
+if [ "x$CLASSPATH" = "x" ]; then
+	CLASSPATH="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
+fi

 cd $DIR

 if [ -f "$DIR/.intree" ]; then
-	CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE:$LOG4J"
+	CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE:$CLASSPATH"
 	LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs"
 else
-	CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$LOG4J"
+	CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$CLASSPATH"
 	# Use system defined java.library.path
 	#LIBPATH="/usr/local/lib:/usr/lib"
 fi
--

-- 
1.9.1
Michael Jeanson | 25 Jun 23:13 2015

[PATCH lttng-ust] Fix: build log4j example when enabled

Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
---
 .gitignore                      |  2 +-
 doc/examples/Makefile.am        | 26 +++++++++++++++++++++++---
 doc/examples/java-jul/run       |  3 ++-
 doc/examples/java-log4j/.intree |  0
 doc/examples/java-log4j/run     |  5 +++--
 5 files changed, 29 insertions(+), 7 deletions(-)
 create mode 100644 doc/examples/java-log4j/.intree

diff --git a/.gitignore b/.gitignore
index 166a260..6ff01a4 100644
--- a/.gitignore
+++ b/.gitignore
 <at>  <at>  -54,7 +54,7  <at>  <at>  tests/benchmark/bench2

 # Java agent library
 *.class
-liblttng-ust-agent.jar
+liblttng-ust-agent*.jar
 classnoinst.stamp
 jni-header.stamp
 jul-jni-header.stamp
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index 0d22602..9404054 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
 <at>  <at>  -8,7 +8,7  <at>  <at>  doc_examples_demo_tracelogdir = ${docdir}/examples/demo-tracelog
 doc_examples_clock_overridedir = ${docdir}/examples/clock-override
 doc_examples_getcpu_overridedir = ${docdir}/examples/getcpu-override

-if BUILD_JAVA_AGENT
+if BUILD_JAVA_AGENT_WITH_JUL
 doc_examples_java_juldir = ${docdir}/examples/java-jul
 dist_doc_examples_java_jul_DATA = java-jul/Makefile \
 				  java-jul/Hello.java \
 <at>  <at>  -16,6 +16,14  <at>  <at>  dist_doc_examples_java_jul_DATA = java-jul/Makefile \
 SUBDIRS_JUL = java-jul
 endif

+if BUILD_JAVA_AGENT_WITH_LOG4J
+doc_examples_java_log4jdir = ${docdir}/examples/java-log4j
+dist_doc_examples_java_log4j_DATA = java-log4j/Makefile \
+				  java-log4j/Hello.java \
+				  java-log4j/run
+SUBDIRS_LOG4J = java-log4j
+endif
+
 dist_doc_examples_DATA = README

 dist_doc_examples_easy_ust_DATA = easy-ust/Makefile \
 <at>  <at>  -74,7 +82,7  <at>  <at>  endif

 all-local:
 	 <at> if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL); do \
+		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J); do \
 			cp -pfR $(srcdir)/$$subdir $(builddir); \
 		done; \
 	fi; \
 <at>  <at>  -99,6 +107,11  <at>  <at>  all-local:
 		for subdir in $(SUBDIRS_JUL); do \
 			(cd $(SUBDIRS_JUL) && $(MAKE)
JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java"
JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
 		done; \
+	fi; \
+	if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
+		for subdir in $(SUBDIRS_LOG4J); do \
+			(cd $(SUBDIRS_LOG4J) && $(MAKE)
JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java"
JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
+		done; \
 	fi;

 clean-local:
 <at>  <at>  -114,8 +127,15  <at>  <at>  clean-local:
 			fi; \
 		done; \
 	fi; \
+	if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
+		for subdir in $(SUBDIRS_LOG4J); do \
+			if [ -d $$subdir ]; then \
+				(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
+			fi; \
+		done; \
+	fi; \
 	if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL); do \
+		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J); do \
 			rm -rf $(builddir)/$$subdir; \
 		done; \
 	fi;
diff --git a/doc/examples/java-jul/run b/doc/examples/java-jul/run
index 1beac85..37a3cfd 100755
--- a/doc/examples/java-jul/run
+++ b/doc/examples/java-jul/run
 <at>  <at>  -16,7 +16,8  <at>  <at>  if [ -f "$DIR/.intree" ]; then
 	LIBPATH="../../../liblttng-ust-java-agent/jni/jul/.libs"
 else
 	CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE"
-	LIBPATH="/usr/local/lib:/usr/lib"
+	# Use system defined java.library.path
+	#LIBPATH="/usr/local/lib:/usr/lib"
 fi

 java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello
diff --git a/doc/examples/java-log4j/.intree b/doc/examples/java-log4j/.intree
new file mode 100644
index 0000000..e69de29
diff --git a/doc/examples/java-log4j/run b/doc/examples/java-log4j/run
index 128725f..5e3cbeb 100755
--- a/doc/examples/java-log4j/run
+++ b/doc/examples/java-log4j/run
 <at>  <at>  -17,9 +17,10  <at>  <at>  if [ -f "$DIR/.intree" ]; then
 	LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs"
 else
 	CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$LOG4J"
-	LIBPATH="/usr/local/lib:/usr/lib"
+	# Use system defined java.library.path
+	#LIBPATH="/usr/local/lib:/usr/lib"
 fi

-java -classpath "$CLASSPATH:." Hello
+java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello

 cd -
--

-- 
1.9.1
Jeffrey Chen | 25 Jun 03:42 2015
Picon

LTTng c++ loglevel not being set

I noticed a macro issue with LTTng under C++. The TRACEPOINT_LOGLEVEL would be ignored.

Here are my steps to repro the issue. My .tp file has the TRACEPOINT_LOGLEVEL macro set.
1. I generated the hello-tp.c file from the hello-tp.tp file using the lttng-gen-tp tool.
2. I renamed the generated .c file into .cpp and compiled with `g++ -c -I. hello-tp.cpp`
3. I wrote my c++ code called and call tracepoint macro, saved to hello.cpp, compiled with `g++ -c -I. hello.cpp`
4. I compile to an executable with `g++ -o hello hello.o hello-tp.o -llttng-ust -ldl`
5. I run the executable, and noticed the loglevel I set in the .tp file is not working. All the traces are still being written as default loglevel TRACE_DEBUG_LINE.

I tried confirming it by using `lttng list --userspace` command and I see "hello_world:my_first_tracepoint (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint)"
You could see the loglevel was not set.

I tried the same steps without renaming to cpp files and build with `gcc` command and it works fine. I also tried without renaming to cpp files but compiled with `g++` command, but it also does not work. It seems to have something to do with c++ name mangling. Anyone noticed this issue? Thanks.
_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Jeffrey Chen | 22 Jun 23:06 2015
Picon

LTTng event loglevel

Hi:

I am reading the LTTng and I am confused about the loglevel in the document. The document talked about it could assign a loglevel to each event. (http://lttng.org/docs/#doc-assigning-log-levels) But, later in the document, it says all events from LTTng are traced as loglevel TRACE_DEBUG_FUNCTION. (http://lttng.org/docs/#doc-liblttng%E2%80%91ust%E2%80%91cyg%E2%80%91profile) So, which is right? Can I assign loglevel to user level traces? Thanks.
_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Gmane