From: David Goulet Date: Mon, 26 Mar 2012 20:55:06 +0000 (-0400) Subject: Merge branch 'master' into benchmark X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=de003c688dc5a05650a45a2fa2b8e946b9aac61b;p=lttng-tools.git Merge branch 'master' into benchmark Signed-off-by: David Goulet --- de003c688dc5a05650a45a2fa2b8e946b9aac61b diff --cc src/bin/lttng-sessiond/Makefile.am index 1e449476c,8748dd6bb..bc99f9b4a --- a/src/bin/lttng-sessiond/Makefile.am +++ b/src/bin/lttng-sessiond/Makefile.am @@@ -1,5 -1,4 +1,6 @@@ -AM_CPPFLAGS = -DINSTALL_BIN_PATH=\""$(lttnglibexecdir)"\" \ ++<<<<<<< HEAD +AM_CPPFLAGS = -I$(top_srcdir)/benchmark \ - -DINSTALL_BIN_PATH=\""$(bindir)"\" \ ++ -DINSTALL_BIN_PATH=\""$(lttnglibexecdir)"\" \ -DINSTALL_LIB_PATH=\""$(libdir)"\" AM_CFLAGS = -fno-strict-aliasing @@@ -33,8 -33,7 +35,8 @@@ lttng_sessiond_LDADD = -lrt -lurcu-comm $(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \ $(top_builddir)/src/common/hashtable/libhashtable.la \ $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/benchmark/liblttng-benchmark.la \ - $(top_builddir)/src/common/libcompat.la - $(top_builddir)/src/common/compat/libcompat.la ++ $(top_builddir)/src/common/compat/libcompat.la \ ++ $(top_builddir)/benchmark/liblttng-benchmark.la if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_LDADD += -llttng-ust-ctl diff --cc src/bin/lttng-sessiond/main.c index cb4dd25e9,3c917b25f..cb186bbbe --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@@ -426,28 -441,35 +443,54 @@@ static void cleanup(void modprobe_remove_lttng_all(); } - close(thread_quit_pipe[0]); - close(thread_quit_pipe[1]); + /* + * Closing all pipes used for communication between threads. + */ + for (i = 0; i < 2; i++) { + if (kernel_poll_pipe[i] >= 0) { + ret = close(kernel_poll_pipe[i]); + if (ret) { + PERROR("close"); + } + + } + } + for (i = 0; i < 2; i++) { + if (thread_quit_pipe[i] >= 0) { + ret = close(thread_quit_pipe[i]); + if (ret) { + PERROR("close"); + } + } + } + for (i = 0; i < 2; i++) { + if (apps_cmd_pipe[i] >= 0) { + ret = close(apps_cmd_pipe[i]); + if (ret) { + PERROR("close"); + } + } + } + /* OUTPUT BENCHMARK RESULTS */ + bench_init(); + + if (getenv("BENCH_UST_NOTIFY")) { + bench_print_ust_notification(); + } + + if (getenv("BENCH_UST_REGISTER")) { + bench_print_ust_register(); + bench_print_ust_unregister(); + } + + if (getenv("BENCH_BOOT_PROCESS")) { + bench_print_boot_process(); + } + + bench_close(); + /* END BENCHMARK */ + /* */ DBG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm" "Matthew, BEET driven development works!%c[%dm", @@@ -857,11 -873,16 +900,18 @@@ static void *thread_manage_kernel(void /* Zeroed the poll events */ lttng_poll_reset(&events); + tracepoint(sessiond_th_kern_poll); + /* Poll infinite value of time */ + restart: ret = lttng_poll_wait(&events, -1); if (ret < 0) { + /* + * Restart interrupted system call. + */ + if (errno == EINTR) { + goto restart; + } goto error; } else if (ret == 0) { /* Should not happen since timeout is infinite */ @@@ -952,11 -968,16 +999,18 @@@ static void *thread_manage_consumer(voi nb_fd = LTTNG_POLL_GETNB(&events); + tracepoint(sessiond_th_kcon_poll); + /* Inifinite blocking call, waiting for transmission */ + restart: ret = lttng_poll_wait(&events, -1); if (ret < 0) { + /* + * Restart interrupted system call. + */ + if (errno == EINTR) { + goto restart; + } goto error; } @@@ -1111,11 -1154,16 +1189,18 @@@ static void *thread_manage_apps(void *d DBG("Apps thread polling on %d fds", nb_fd); + tracepoint(sessiond_th_apps_poll); + /* Inifinite blocking call, waiting for transmission */ + restart: ret = lttng_poll_wait(&events, -1); if (ret < 0) { + /* + * Restart interrupted system call. + */ + if (errno == EINTR) { + goto restart; + } goto error; } @@@ -1140,12 -1187,10 +1225,12 @@@ /* Empty pipe */ ret = read(apps_cmd_pipe[0], &ust_cmd, sizeof(ust_cmd)); if (ret < 0 || ret < sizeof(ust_cmd)) { - perror("read apps cmd pipe"); + PERROR("read apps cmd pipe"); goto error; } + tracepoint(ust_register_read_stop); + tracepoint(ust_register_add_start); /* Register applicaton to the session daemon */ ret = ust_app_register(&ust_cmd.reg_msg, ust_cmd.sock); @@@ -3455,10 -3551,13 +3616,15 @@@ skip_domain } case LTTNG_DESTROY_SESSION: { + tracepoint(destroy_session_start); ret = cmd_destroy_session(cmd_ctx->session, cmd_ctx->lsm->session.name); + tracepoint(destroy_session_end); + /* + * Set session to NULL so we do not unlock it after + * free. + */ + cmd_ctx->session = NULL; break; } case LTTNG_LIST_DOMAINS: @@@ -4498,11 -4664,9 +4737,11 @@@ int main(int argc, char **argv goto exit_kernel; } + tracepoint(sessiond_boot_end); + ret = pthread_join(kernel_thread, &status); if (ret != 0) { - perror("pthread_join"); + PERROR("pthread_join"); goto error; /* join error, exit without cleanup */ } diff --cc src/bin/lttng-sessiond/shm.c index 0bf3ff58f,584ae078f..e785aaa8b --- a/src/bin/lttng-sessiond/shm.c +++ b/src/bin/lttng-sessiond/shm.c @@@ -111,14 -104,16 +111,18 @@@ static int get_wait_shm(char *shm_path exit(EXIT_FAILURE); } + #ifndef __FreeBSD__ ret = fchmod(wait_shm_fd, mode); if (ret < 0) { - perror("fchmod"); + PERROR("fchmod"); exit(EXIT_FAILURE); } + #else + #warning "FreeBSD does not support setting file mode on shm FD. Remember that for secure use, lttng-sessiond should be started before applications linked on lttng-ust." + #endif + tracepoint(ust_notify_shm_stop); + DBG("Got the wait shm fd %d", wait_shm_fd); return wait_shm_fd;