projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into benchmark
[lttng-tools.git]
/
lttng-sessiond
/
main.c
diff --git
a/lttng-sessiond/main.c
b/lttng-sessiond/main.c
index b2d421e56b15b8bd9e6534a35819d9755853d8f2..db0d661016889924c3310e42eec5f1a931e1f834 100644
(file)
--- a/
lttng-sessiond/main.c
+++ b/
lttng-sessiond/main.c
@@
-50,13
+50,15
@@
#include "event.h"
#include "futex.h"
#include "hashtable.h"
#include "event.h"
#include "futex.h"
#include "hashtable.h"
-#include "kernel
-ctl
.h"
+#include "kernel.h"
#include "lttng-sessiond.h"
#include "shm.h"
#include "ust-app.h"
#include "ust-ctl.h"
#include "utils.h"
#include "lttng-sessiond.h"
#include "shm.h"
#include "ust-app.h"
#include "ust-ctl.h"
#include "utils.h"
+#define CONSUMERD_FILE "lttng-consumerd"
+
struct consumer_data {
enum lttng_consumer_type type;
struct consumer_data {
enum lttng_consumer_type type;
@@
-75,6
+77,8
@@
struct consumer_data {
char cmd_unix_sock_path[PATH_MAX];
};
char cmd_unix_sock_path[PATH_MAX];
};
+#include "benchmark.h"
+
/* Const values */
const char default_home_dir[] = DEFAULT_HOME_DIR;
const char default_tracing_group[] = LTTNG_DEFAULT_TRACING_GROUP;
/* Const values */
const char default_home_dir[] = DEFAULT_HOME_DIR;
const char default_tracing_group[] = LTTNG_DEFAULT_TRACING_GROUP;
@@
-169,31
+173,38
@@
static struct ltt_session_list *session_list_ptr;
int ust_consumerd64_fd = -1;
int ust_consumerd32_fd = -1;
int ust_consumerd64_fd = -1;
int ust_consumerd32_fd = -1;
-static const char *consumerd64_prog = "lttng-consumerd";
-static const char *consumerd32_prog = "lttng-consumerd";
-
-static const char *consumerd64_bindir =
- __stringify(CONFIG_64BIT_BINDIR);
-static const char *consumerd32_bindir =
- __stringify(CONFIG_32BIT_BINDIR);
+static const char *consumerd32_path =
+ __stringify(CONFIG_CONSUMERD32_PATH);
+static const char *consumerd64_path =
+ __stringify(CONFIG_CONSUMERD64_PATH);
+static const char *consumerd32_libdir =
+ __stringify(CONFIG_CONSUMERD32_LIBDIR);
+static const char *consumerd64_libdir =
+ __stringify(CONFIG_CONSUMERD64_LIBDIR);
static
void setup_consumerd_path(void)
{
static
void setup_consumerd_path(void)
{
- const char *
bin
dir;
+ const char *
path, *lib
dir;
/*
* Allow INSTALL_BIN_PATH to be used as a target path for the
/*
* Allow INSTALL_BIN_PATH to be used as a target path for the
- * native architecture size consumer if CONFIG_
NBIT_BINDIR as
- * not been defined.
+ * native architecture size consumer if CONFIG_
CONSUMER*_PATH
+ *
has
not been defined.
*/
*/
-#if (CAA_BITS_PER_LONG ==
64
)
- if (!consumerd
64_bindir
[0]) {
- consumerd
64_bindir = INSTALL_BIN_PATH
;
+#if (CAA_BITS_PER_LONG ==
32
)
+ if (!consumerd
32_path
[0]) {
+ consumerd
32_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE
;
}
}
-#elif (CAA_BITS_PER_LONG == 32)
- if (!consumerd32_bindir[0]) {
- consumerd32_bindir = INSTALL_BIN_PATH;
+ if (!consumerd32_libdir[0]) {
+ consumerd32_libdir = INSTALL_LIB_PATH;
+ }
+#elif (CAA_BITS_PER_LONG == 64)
+ if (!consumerd64_path[0]) {
+ consumerd64_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
+ }
+ if (!consumerd64_libdir[0]) {
+ consumerd64_libdir = INSTALL_LIB_PATH;
}
#else
#error "Unknown bitness"
}
#else
#error "Unknown bitness"
@@
-202,13
+213,21
@@
void setup_consumerd_path(void)
/*
* runtime env. var. overrides the build default.
*/
/*
* runtime env. var. overrides the build default.
*/
- bindir = getenv("LTTNG_TOOLS_64BIT_BINDIR");
- if (bindir) {
- consumerd64_bindir = bindir;
+ path = getenv("LTTNG_CONSUMERD32_PATH");
+ if (path) {
+ consumerd32_path = path;
+ }
+ path = getenv("LTTNG_CONSUMERD64_PATH");
+ if (path) {
+ consumerd64_path = path;
}
}
- bindir = getenv("LTTNG_TOOLS_32BIT_BINDIR");
- if (bindir) {
- consumerd32_bindir = bindir;
+ libdir = getenv("LTTNG_TOOLS_CONSUMERD32_LIBDIR");
+ if (libdir) {
+ consumerd32_libdir = libdir;
+ }
+ libdir = getenv("LTTNG_TOOLS_CONSUMERD64_LIBDIR");
+ if (libdir) {
+ consumerd64_libdir = libdir;
}
}
}
}
@@
-451,6
+470,25
@@
static void cleanup(void)
close(thread_quit_pipe[0]);
close(thread_quit_pipe[1]);
close(thread_quit_pipe[0]);
close(thread_quit_pipe[1]);
+ /* 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 */
+
/* <fun> */
MSG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm"
"Matthew, BEET driven development works!%c[%dm",
/* <fun> */
MSG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm"
"Matthew, BEET driven development works!%c[%dm",
@@
-627,6
+665,8
@@
static int notify_ust_apps(int active)
DBG("Notifying applications of session daemon state: %d", active);
DBG("Notifying applications of session daemon state: %d", active);
+ tracepoint(ust_notify_apps_start);
+
/* See shm.c for this call implying mmap, shm and futex calls */
wait_shm_mmap = shm_ust_get_mmap(wait_shm_path, is_root);
if (wait_shm_mmap == NULL) {
/* See shm.c for this call implying mmap, shm and futex calls */
wait_shm_mmap = shm_ust_get_mmap(wait_shm_path, is_root);
if (wait_shm_mmap == NULL) {
@@
-636,6
+676,8
@@
static int notify_ust_apps(int active)
/* Wake waiting process */
futex_wait_update((int32_t *) wait_shm_mmap, active);
/* Wake waiting process */
futex_wait_update((int32_t *) wait_shm_mmap, active);
+ tracepoint(ust_notify_apps_stop);
+
/* Apps notified successfully */
return 0;
/* Apps notified successfully */
return 0;
@@
-807,6
+849,8
@@
static void *thread_manage_kernel(void *data)
char tmp;
struct lttng_poll_event events;
char tmp;
struct lttng_poll_event events;
+ tracepoint(sessiond_th_kern_start);
+
DBG("Thread manage kernel started");
ret = create_thread_poll_set(&events, 2);
DBG("Thread manage kernel started");
ret = create_thread_poll_set(&events, 2);
@@
-841,6
+885,8
@@
static void *thread_manage_kernel(void *data)
/* Zeroed the poll events */
lttng_poll_reset(&events);
/* Zeroed the poll events */
lttng_poll_reset(&events);
+ tracepoint(sessiond_th_kern_poll);
+
/* Poll infinite value of time */
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
/* Poll infinite value of time */
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
@@
-909,6
+955,8
@@
static void *thread_manage_consumer(void *data)
struct lttng_poll_event events;
struct consumer_data *consumer_data = data;
struct lttng_poll_event events;
struct consumer_data *consumer_data = data;
+ tracepoint(sessiond_th_kcon_start);
+
DBG("[thread] Manage consumer started");
ret = lttcomm_listen_unix_sock(consumer_data->err_sock);
DBG("[thread] Manage consumer started");
ret = lttcomm_listen_unix_sock(consumer_data->err_sock);
@@
-932,6
+980,8
@@
static void *thread_manage_consumer(void *data)
nb_fd = LTTNG_POLL_GETNB(&events);
nb_fd = LTTNG_POLL_GETNB(&events);
+ tracepoint(sessiond_th_kcon_poll);
+
/* Inifinite blocking call, waiting for transmission */
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
/* Inifinite blocking call, waiting for transmission */
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
@@
-1064,6
+1114,8
@@
static void *thread_manage_apps(void *data)
struct ust_command ust_cmd;
struct lttng_poll_event events;
struct ust_command ust_cmd;
struct lttng_poll_event events;
+ tracepoint(sessiond_th_apps_start);
+
DBG("[thread] Manage application started");
rcu_register_thread();
DBG("[thread] Manage application started");
rcu_register_thread();
@@
-1087,6
+1139,8
@@
static void *thread_manage_apps(void *data)
DBG("Apps thread polling on %d fds", nb_fd);
DBG("Apps thread polling on %d fds", nb_fd);
+ tracepoint(sessiond_th_apps_poll);
+
/* Inifinite blocking call, waiting for transmission */
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
/* Inifinite blocking call, waiting for transmission */
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
@@
-1110,13
+1164,16
@@
static void *thread_manage_apps(void *data)
ERR("Apps command pipe error");
goto error;
} else if (revents & LPOLLIN) {
ERR("Apps command pipe error");
goto error;
} else if (revents & LPOLLIN) {
+ tracepoint(ust_register_read_start);
/* 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");
goto error;
}
/* 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");
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);
/* Register applicaton to the session daemon */
ret = ust_app_register(&ust_cmd.reg_msg,
ust_cmd.sock);
@@
-1125,7
+1182,9
@@
static void *thread_manage_apps(void *data)
} else if (ret < 0) {
break;
}
} else if (ret < 0) {
break;
}
+ tracepoint(ust_register_add_stop);
+ tracepoint(ust_register_done_start);
/*
* Add channel(s) and event(s) to newly registered apps
* from lttng global UST domain.
/*
* Add channel(s) and event(s) to newly registered apps
* from lttng global UST domain.
@@
-1152,7
+1211,7
@@
static void *thread_manage_apps(void *data)
DBG("Apps with sock %d added to poll set",
ust_cmd.sock);
}
DBG("Apps with sock %d added to poll set",
ust_cmd.sock);
}
-
+ tracepoint(ust_register_done_stop);
break;
}
} else {
break;
}
} else {
@@
-1197,6
+1256,8
@@
static void *thread_dispatch_ust_registration(void *data)
struct cds_wfq_node *node;
struct ust_command *ust_cmd = NULL;
struct cds_wfq_node *node;
struct ust_command *ust_cmd = NULL;
+ tracepoint(sessiond_th_dispatch_start);
+
DBG("[thread] Dispatch UST command started");
while (!dispatch_thread_exit) {
DBG("[thread] Dispatch UST command started");
while (!dispatch_thread_exit) {
@@
-1204,6
+1265,8
@@
static void *thread_dispatch_ust_registration(void *data)
futex_nto1_prepare(&ust_cmd_queue.futex);
do {
futex_nto1_prepare(&ust_cmd_queue.futex);
do {
+ tracepoint(sessiond_th_dispatch_block);
+
/* Dequeue command for registration */
node = cds_wfq_dequeue_blocking(&ust_cmd_queue.queue);
if (node == NULL) {
/* Dequeue command for registration */
node = cds_wfq_dequeue_blocking(&ust_cmd_queue.queue);
if (node == NULL) {
@@
-1212,6
+1275,8
@@
static void *thread_dispatch_ust_registration(void *data)
break;
}
break;
}
+ tracepoint(ust_dispatch_register_start);
+
ust_cmd = caa_container_of(node, struct ust_command, node);
DBG("Dispatching UST registration pid:%d ppid:%d uid:%d"
ust_cmd = caa_container_of(node, struct ust_command, node);
DBG("Dispatching UST registration pid:%d ppid:%d uid:%d"
@@
-1242,6
+1307,8
@@
static void *thread_dispatch_ust_registration(void *data)
free(ust_cmd);
} while (node != NULL);
free(ust_cmd);
} while (node != NULL);
+ tracepoint(ust_dispatch_register_stop);
+
/* Futex wait on queue. Blocking call on futex() */
futex_nto1_wait(&ust_cmd_queue.futex);
}
/* Futex wait on queue. Blocking call on futex() */
futex_nto1_wait(&ust_cmd_queue.futex);
}
@@
-1265,6
+1332,8
@@
static void *thread_registration_apps(void *data)
*/
struct ust_command *ust_cmd = NULL;
*/
struct ust_command *ust_cmd = NULL;
+ tracepoint(sessiond_th_reg_start);
+
DBG("[thread] Manage application registration started");
ret = lttcomm_listen_unix_sock(apps_sock);
DBG("[thread] Manage application registration started");
ret = lttcomm_listen_unix_sock(apps_sock);
@@
-1298,6
+1367,8
@@
static void *thread_registration_apps(void *data)
while (1) {
DBG("Accepting application registration");
while (1) {
DBG("Accepting application registration");
+ tracepoint(sessiond_th_reg_poll);
+
nb_fd = LTTNG_POLL_GETNB(&events);
/* Inifinite blocking call, waiting for transmission */
nb_fd = LTTNG_POLL_GETNB(&events);
/* Inifinite blocking call, waiting for transmission */
@@
-1323,6
+1394,9
@@
static void *thread_registration_apps(void *data)
ERR("Register apps socket poll error");
goto error;
} else if (revents & LPOLLIN) {
ERR("Register apps socket poll error");
goto error;
} else if (revents & LPOLLIN) {
+ /* Registration starts here. Recording cycles */
+ tracepoint(ust_register_start);
+
sock = lttcomm_accept_unix_sock(apps_sock);
if (sock < 0) {
goto error;
sock = lttcomm_accept_unix_sock(apps_sock);
if (sock < 0) {
goto error;
@@
-1372,6
+1446,8
@@
static void *thread_registration_apps(void *data)
* barrier with the exchange in cds_wfq_enqueue.
*/
futex_nto1_wake(&ust_cmd_queue.futex);
* barrier with the exchange in cds_wfq_enqueue.
*/
futex_nto1_wake(&ust_cmd_queue.futex);
+
+ tracepoint(ust_register_stop);
}
}
}
}
}
}
@@
-1515,26
+1591,88
@@
static pid_t spawn_consumerd(struct consumer_data *consumer_data)
break;
case LTTNG_CONSUMER64_UST:
{
break;
case LTTNG_CONSUMER64_UST:
{
- char path[PATH_MAX];
+ char *tmpnew = NULL;
+
+ if (consumerd64_libdir[0] != '\0') {
+ char *tmp;
+ size_t tmplen;
- snprintf(path, PATH_MAX, "%s/%s",
- consumerd64_bindir, consumerd64_prog);
- execl(path, verbosity, "-u",
+ tmp = getenv("LD_LIBRARY_PATH");
+ if (!tmp) {
+ tmp = "";
+ }
+ tmplen = strlen("LD_LIBRARY_PATH=")
+ + strlen(consumerd64_libdir) + 1 /* : */ + strlen(tmp);
+ tmpnew = zmalloc(tmplen + 1 /* \0 */);
+ if (!tmpnew) {
+ ret = -ENOMEM;
+ goto error;
+ }
+ strcpy(tmpnew, "LD_LIBRARY_PATH=");
+ strcat(tmpnew, consumerd64_libdir);
+ if (tmp[0] != '\0') {
+ strcat(tmpnew, ":");
+ strcat(tmpnew, tmp);
+ }
+ ret = putenv(tmpnew);
+ if (ret) {
+ ret = -errno;
+ goto error;
+ }
+ }
+ ret = execl(consumerd64_path, verbosity, "-u",
"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
"--consumerd-err-sock", consumer_data->err_unix_sock_path,
NULL);
"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
"--consumerd-err-sock", consumer_data->err_unix_sock_path,
NULL);
+ if (consumerd64_libdir[0] != '\0') {
+ free(tmpnew);
+ }
+ if (ret) {
+ goto error;
+ }
break;
}
case LTTNG_CONSUMER32_UST:
{
break;
}
case LTTNG_CONSUMER32_UST:
{
- char
path[PATH_MAX]
;
+ char
*tmpnew = NULL
;
- snprintf(path, PATH_MAX, "%s/%s",
- consumerd32_bindir, consumerd32_prog);
- execl(path, verbosity, "-u",
+ if (consumerd32_libdir[0] != '\0') {
+ char *tmp;
+ size_t tmplen;
+
+ tmp = getenv("LD_LIBRARY_PATH");
+ if (!tmp) {
+ tmp = "";
+ }
+ tmplen = strlen("LD_LIBRARY_PATH=")
+ + strlen(consumerd32_libdir) + 1 /* : */ + strlen(tmp);
+ tmpnew = zmalloc(tmplen + 1 /* \0 */);
+ if (!tmpnew) {
+ ret = -ENOMEM;
+ goto error;
+ }
+ strcpy(tmpnew, "LD_LIBRARY_PATH=");
+ strcat(tmpnew, consumerd32_libdir);
+ if (tmp[0] != '\0') {
+ strcat(tmpnew, ":");
+ strcat(tmpnew, tmp);
+ }
+ ret = putenv(tmpnew);
+ if (ret) {
+ ret = -errno;
+ goto error;
+ }
+ }
+ ret = execl(consumerd32_path, verbosity, "-u",
"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
"--consumerd-err-sock", consumer_data->err_unix_sock_path,
NULL);
"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
"--consumerd-err-sock", consumer_data->err_unix_sock_path,
NULL);
+ if (consumerd32_libdir[0] != '\0') {
+ free(tmpnew);
+ }
+ if (ret) {
+ goto error;
+ }
break;
}
default:
break;
}
default:
@@
-1551,6
+1689,7
@@
static pid_t spawn_consumerd(struct consumer_data *consumer_data)
perror("start consumer fork");
ret = -errno;
}
perror("start consumer fork");
ret = -errno;
}
+error:
return ret;
}
return ret;
}
@@
-1993,6
+2132,11
@@
static int list_lttng_ust_global_events(char *channel_name,
case LTTNG_UST_FUNCTION:
tmp[i].type = LTTNG_EVENT_FUNCTION;
break;
case LTTNG_UST_FUNCTION:
tmp[i].type = LTTNG_EVENT_FUNCTION;
break;
+ case LTTNG_UST_TRACEPOINT_LOGLEVEL:
+ /* TODO */
+ ret = -LTTCOMM_NOT_IMPLEMENTED;
+ goto error;
+ break;
}
i++;
}
}
i++;
}
@@
-2111,7
+2255,13
@@
static int cmd_disable_channel(struct ltt_session *session,
goto error;
}
goto error;
}
- ret = ust_app_disable_channel_all(usess, uchan);
+ /* Already disabled */
+ if (!uchan->enabled) {
+ DBG2("UST channel %s already disabled", channel_name);
+ break;
+ }
+
+ ret = ust_app_disable_channel_glb(usess, uchan);
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
@@
-2219,28
+2369,32
@@
static int cmd_enable_channel(struct ltt_session *session,
goto error;
}
goto error;
}
- rcu_read_lock();
- hashtable_add_unique(usess->domain_global.channels, &uchan->node);
- rcu_read_unlock();
- DBG2("UST channel %s added to global domain HT", attr->name);
-
/* Add channel to all registered applications */
/* Add channel to all registered applications */
- ret = ust_app_create_channel_
all
(usess, uchan);
+ ret = ust_app_create_channel_
glb
(usess, uchan);
if (ret != 0) {
ret = LTTCOMM_UST_CHAN_FAIL;
goto error;
}
if (ret != 0) {
ret = LTTCOMM_UST_CHAN_FAIL;
goto error;
}
+
+ rcu_read_lock();
+ hashtable_add_unique(usess->domain_global.channels, &uchan->node);
+ rcu_read_unlock();
+
+ DBG2("UST channel %s added to global domain HT", attr->name);
} else {
/* If already enabled, everything is OK */
if (uchan->enabled) {
} else {
/* If already enabled, everything is OK */
if (uchan->enabled) {
- ret = LTTCOMM_OK;
- goto error;
+ break;
}
}
- ret = ust_app_enable_channel_
all
(usess, uchan);
+ ret = ust_app_enable_channel_
glb
(usess, uchan);
if (ret < 0) {
if (ret < 0) {
- ret = LTTCOMM_UST_ENABLE_FAIL;
- goto error;
+ if (ret != -EEXIST) {
+ ret = LTTCOMM_UST_CHAN_ENABLE_FAIL;
+ goto error;
+ } else {
+ ret = LTTCOMM_OK;
+ }
}
}
}
}
@@
-2276,15
+2430,17
@@
static int cmd_disable_event(struct ltt_session *session, int domain,
case LTTNG_DOMAIN_KERNEL:
{
struct ltt_kernel_channel *kchan;
case LTTNG_DOMAIN_KERNEL:
{
struct ltt_kernel_channel *kchan;
+ struct ltt_kernel_session *ksess;
- kchan = trace_kernel_get_channel_by_name(channel_name,
- session->kernel_session);
+ ksess = session->kernel_session;
+
+ kchan = trace_kernel_get_channel_by_name(channel_name, ksess);
if (kchan == NULL) {
ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
goto error;
}
if (kchan == NULL) {
ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
goto error;
}
- ret = event_kernel_disable_tracepoint(
session->kernel_session
, kchan, event_name);
+ ret = event_kernel_disable_tracepoint(
ksess
, kchan, event_name);
if (ret != LTTCOMM_OK) {
goto error;
}
if (ret != LTTCOMM_OK) {
goto error;
}
@@
-2293,11
+2449,43
@@
static int cmd_disable_event(struct ltt_session *session, int domain,
break;
}
case LTTNG_DOMAIN_UST:
break;
}
case LTTNG_DOMAIN_UST:
+ {
+ struct ltt_ust_session *usess;
+ struct ltt_ust_channel *uchan;
+ struct ltt_ust_event *uevent;
+
+ usess = session->ust_session;
+
+ uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
+ channel_name);
+ if (uchan == NULL) {
+ ret = LTTCOMM_UST_CHAN_NOT_FOUND;
+ goto error;
+ }
+
+ uevent = trace_ust_find_event_by_name(uchan->events, event_name);
+ if (uevent == NULL) {
+ ret = LTTCOMM_UST_EVENT_NOT_FOUND;
+ goto error;
+ }
+
+ ret = ust_app_disable_event_glb(usess, uchan, uevent);
+ if (ret < 0) {
+ ret = LTTCOMM_UST_DISABLE_FAIL;
+ goto error;
+ }
+
+ uevent->enabled = 0;
+
+ DBG2("Disable UST event %s in channel %s completed", event_name,
+ channel_name);
+
+ break;
+ }
case LTTNG_DOMAIN_UST_EXEC_NAME:
case LTTNG_DOMAIN_UST_PID:
case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
default:
case LTTNG_DOMAIN_UST_EXEC_NAME:
case LTTNG_DOMAIN_UST_PID:
case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
default:
- /* TODO: Other UST domains */
ret = LTTCOMM_NOT_IMPLEMENTED;
goto error;
}
ret = LTTCOMM_NOT_IMPLEMENTED;
goto error;
}
@@
-2352,7
+2540,7
@@
static int cmd_disable_event_all(struct ltt_session *session, int domain,
goto error;
}
goto error;
}
- ret = ust_app_disable_
event_all
(usess, uchan);
+ ret = ust_app_disable_
all_event_glb
(usess, uchan);
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
@@
-2395,21
+2583,18
@@
static int cmd_add_context(struct ltt_session *session, int domain,
break;
case LTTNG_DOMAIN_UST:
{
break;
case LTTNG_DOMAIN_UST:
{
- /*
- struct ltt_ust_session *usess;
+ struct ltt_ust_session *usess = session->ust_session;
- cds_list_for_each_entry(usess, &session->ust_session_list.head, list) {
- ret = context_ust_add(usess, ctx,
- event_name, channel_name, domain);
- if (ret != LTTCOMM_OK) {
- goto error;
- }
+ ret = context_ust_add(usess, domain, ctx, event_name, channel_name);
+ if (ret != LTTCOMM_OK) {
+ goto error;
}
break;
}
break;
- */
}
}
+ case LTTNG_DOMAIN_UST_EXEC_NAME:
+ case LTTNG_DOMAIN_UST_PID:
+ case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
default:
default:
- /* TODO: UST other domains */
ret = LTTCOMM_NOT_IMPLEMENTED;
goto error;
}
ret = LTTCOMM_NOT_IMPLEMENTED;
goto error;
}
@@
-2449,8
+2634,10
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
ret = channel_kernel_create(session->kernel_session,
attr, kernel_poll_pipe[1]);
if (ret != LTTCOMM_OK) {
ret = channel_kernel_create(session->kernel_session,
attr, kernel_poll_pipe[1]);
if (ret != LTTCOMM_OK) {
+ free(attr);
goto error;
}
goto error;
}
+ free(attr);
}
/* Get the newly created kernel channel pointer */
}
/* Get the newly created kernel channel pointer */
@@
-2473,10
+2660,10
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
}
case LTTNG_DOMAIN_UST:
{
}
case LTTNG_DOMAIN_UST:
{
- struct ltt_ust_channel *uchan;
- struct ltt_ust_event *uevent;
struct lttng_channel *attr;
struct lttng_channel *attr;
+ struct ltt_ust_channel *uchan;
+ /* Get channel from global UST domain */
uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
channel_name);
if (uchan == NULL) {
uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
channel_name);
if (uchan == NULL) {
@@
-2487,13
+2674,14
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
goto error;
}
snprintf(attr->name, NAME_MAX, "%s", channel_name);
goto error;
}
snprintf(attr->name, NAME_MAX, "%s", channel_name);
+ attr->name[NAME_MAX - 1] = '\0';
/* Use the internal command enable channel */
ret = cmd_enable_channel(session, domain, attr);
/* Use the internal command enable channel */
ret = cmd_enable_channel(session, domain, attr);
- if (ret < 0) {
+ if (ret != LTTCOMM_OK) {
+ free(attr);
goto error;
}
goto error;
}
-
free(attr);
/* Get the newly created channel reference back */
free(attr);
/* Get the newly created channel reference back */
@@
-2506,31
+2694,12
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
}
}
}
}
- uevent = trace_ust_find_event_by_name(uchan->events, event->name);
- if (uevent == NULL) {
- uevent = trace_ust_create_event(event);
- if (uevent == NULL) {
- ret = LTTCOMM_FATAL;
- goto error;
- }
-
- }
+ /* At this point, the session and channel exist on the tracer */
- ret = ust_app_create_event_all(usess, uchan, uevent);
- if (ret < 0) {
- ret = LTTCOMM_UST_ENABLE_FAIL;
+ ret = event_ust_enable_tracepoint(usess, domain, uchan, event);
+ if (ret != LTTCOMM_OK) {
goto error;
}
goto error;
}
-
- /* Add ltt ust event to channel */
- rcu_read_lock();
- hashtable_add_unique(uchan->events, &uevent->node);
- rcu_read_unlock();
-
- uevent->enabled = 1;
-
- DBG3("UST ltt event %s added to channel %s", uevent->attr.name,
- uchan->name);
break;
}
case LTTNG_DOMAIN_UST_EXEC_NAME:
break;
}
case LTTNG_DOMAIN_UST_EXEC_NAME:
@@
-2567,15
+2736,16
@@
static int cmd_enable_event_all(struct ltt_session *session, int domain,
if (ret != LTTCOMM_OK) {
goto error;
}
if (ret != LTTCOMM_OK) {
goto error;
}
- }
- /* Get the newly created kernel channel pointer */
- kchan = trace_kernel_get_channel_by_name(channel_name,
- session->kernel_session);
- if (kchan == NULL) {
- /* This sould not happen... */
- ret = LTTCOMM_FATAL;
- goto error;
+ /* Get the newly created kernel channel pointer */
+ kchan = trace_kernel_get_channel_by_name(channel_name,
+ session->kernel_session);
+ if (kchan == NULL) {
+ /* This sould not happen... */
+ ret = LTTCOMM_FATAL;
+ goto error;
+ }
+
}
switch (event_type) {
}
switch (event_type) {
@@
-2600,6
+2770,8
@@
static int cmd_enable_event_all(struct ltt_session *session, int domain,
ret = LTTCOMM_KERN_ENABLE_FAIL;
goto error;
}
ret = LTTCOMM_KERN_ENABLE_FAIL;
goto error;
}
+
+ /* Manage return value */
if (ret != LTTCOMM_OK) {
goto error;
}
if (ret != LTTCOMM_OK) {
goto error;
}
@@
-3152,7
+3324,7
@@
static int process_client_msg(struct command_ctx *cmd_ctx)
/* Start the UST consumer daemons */
/* 64-bit */
pthread_mutex_lock(&ustconsumer64_data.pid_mutex);
/* Start the UST consumer daemons */
/* 64-bit */
pthread_mutex_lock(&ustconsumer64_data.pid_mutex);
- if (consumerd64_
bindir
[0] != '\0' &&
+ if (consumerd64_
path
[0] != '\0' &&
ustconsumer64_data.pid == 0 &&
cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
ustconsumer64_data.pid == 0 &&
cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
@@
-3168,7
+3340,7
@@
static int process_client_msg(struct command_ctx *cmd_ctx)
pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
}
/* 32-bit */
pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
}
/* 32-bit */
- if (consumerd32_
bindir
[0] != '\0' &&
+ if (consumerd32_
path
[0] != '\0' &&
ustconsumer32_data.pid == 0 &&
cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
ustconsumer32_data.pid == 0 &&
cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
@@
-3285,14
+3457,18
@@
static int process_client_msg(struct command_ctx *cmd_ctx)
}
case LTTNG_CREATE_SESSION:
{
}
case LTTNG_CREATE_SESSION:
{
+ tracepoint(create_session_start);
ret = cmd_create_session(cmd_ctx->lsm->session.name,
cmd_ctx->lsm->session.path);
ret = cmd_create_session(cmd_ctx->lsm->session.name,
cmd_ctx->lsm->session.path);
+ tracepoint(create_session_end);
break;
}
case LTTNG_DESTROY_SESSION:
{
break;
}
case LTTNG_DESTROY_SESSION:
{
+ tracepoint(destroy_session_start);
ret = cmd_destroy_session(cmd_ctx->session,
cmd_ctx->lsm->session.name);
ret = cmd_destroy_session(cmd_ctx->session,
cmd_ctx->lsm->session.name);
+ tracepoint(destroy_session_end);
break;
}
case LTTNG_LIST_DOMAINS:
break;
}
case LTTNG_LIST_DOMAINS:
@@
-3442,6
+3618,8
@@
static void *thread_manage_clients(void *data)
struct command_ctx *cmd_ctx = NULL;
struct lttng_poll_event events;
struct command_ctx *cmd_ctx = NULL;
struct lttng_poll_event events;
+ tracepoint(sessiond_th_cli_start);
+
DBG("[thread] Manage client started");
rcu_register_thread();
DBG("[thread] Manage client started");
rcu_register_thread();
@@
-3476,6
+3654,8
@@
static void *thread_manage_clients(void *data)
while (1) {
DBG("Accepting client command ...");
while (1) {
DBG("Accepting client command ...");
+ tracepoint(sessiond_th_cli_poll);
+
nb_fd = LTTNG_POLL_GETNB(&events);
/* Inifinite blocking call, waiting for transmission */
nb_fd = LTTNG_POLL_GETNB(&events);
/* Inifinite blocking call, waiting for transmission */
@@
-3608,8
+3788,10
@@
static void usage(void)
fprintf(stderr, " --ustconsumerd64-err-sock PATH Specify path for the 64-bit UST consumer error socket\n");
fprintf(stderr, " --ustconsumerd32-cmd-sock PATH Specify path for the 32-bit UST consumer command socket\n");
fprintf(stderr, " --ustconsumerd64-cmd-sock PATH Specify path for the 64-bit UST consumer command socket\n");
fprintf(stderr, " --ustconsumerd64-err-sock PATH Specify path for the 64-bit UST consumer error socket\n");
fprintf(stderr, " --ustconsumerd32-cmd-sock PATH Specify path for the 32-bit UST consumer command socket\n");
fprintf(stderr, " --ustconsumerd64-cmd-sock PATH Specify path for the 64-bit UST consumer command socket\n");
- fprintf(stderr, " --ustconsumerd32 PATH Specify path for the 32-bit UST consumer daemon binary\n");
- fprintf(stderr, " --ustconsumerd64 PATH Specify path for the 64-bit UST consumer daemon binary\n");
+ fprintf(stderr, " --consumerd32-path PATH Specify path for the 32-bit UST consumer daemon binary\n");
+ fprintf(stderr, " --consumerd32-libdir PATH Specify path for the 32-bit UST consumer daemon libraries\n");
+ fprintf(stderr, " --consumerd64-path PATH Specify path for the 64-bit UST consumer daemon binary\n");
+ fprintf(stderr, " --consumerd64-libdir PATH Specify path for the 64-bit UST consumer daemon libraries\n");
fprintf(stderr, " -d, --daemonize Start as a daemon.\n");
fprintf(stderr, " -g, --group NAME Specify the tracing group name. (default: tracing)\n");
fprintf(stderr, " -V, --version Show version number.\n");
fprintf(stderr, " -d, --daemonize Start as a daemon.\n");
fprintf(stderr, " -g, --group NAME Specify the tracing group name. (default: tracing)\n");
fprintf(stderr, " -V, --version Show version number.\n");
@@
-3631,12
+3813,14
@@
static int parse_args(int argc, char **argv)
{ "apps-sock", 1, 0, 'a' },
{ "kconsumerd-cmd-sock", 1, 0, 'C' },
{ "kconsumerd-err-sock", 1, 0, 'E' },
{ "apps-sock", 1, 0, 'a' },
{ "kconsumerd-cmd-sock", 1, 0, 'C' },
{ "kconsumerd-err-sock", 1, 0, 'E' },
- { "ustconsumerd64", 1, 0, 't' },
- { "ustconsumerd64-cmd-sock", 1, 0, 'D' },
- { "ustconsumerd64-err-sock", 1, 0, 'F' },
- { "ustconsumerd32", 1, 0, 'u' },
{ "ustconsumerd32-cmd-sock", 1, 0, 'G' },
{ "ustconsumerd32-err-sock", 1, 0, 'H' },
{ "ustconsumerd32-cmd-sock", 1, 0, 'G' },
{ "ustconsumerd32-err-sock", 1, 0, 'H' },
+ { "ustconsumerd64-cmd-sock", 1, 0, 'D' },
+ { "ustconsumerd64-err-sock", 1, 0, 'F' },
+ { "consumerd32-path", 1, 0, 'u' },
+ { "consumerd32-libdir", 1, 0, 'U' },
+ { "consumerd64-path", 1, 0, 't' },
+ { "consumerd64-libdir", 1, 0, 'T' },
{ "daemonize", 0, 0, 'd' },
{ "sig-parent", 0, 0, 'S' },
{ "help", 0, 0, 'h' },
{ "daemonize", 0, 0, 'd' },
{ "sig-parent", 0, 0, 'S' },
{ "help", 0, 0, 'h' },
@@
-3713,10
+3897,16
@@
static int parse_args(int argc, char **argv)
opt_verbose_consumer += 1;
break;
case 'u':
opt_verbose_consumer += 1;
break;
case 'u':
- consumerd32_bindir = optarg;
+ consumerd32_path= optarg;
+ break;
+ case 'U':
+ consumerd32_libdir = optarg;
break;
case 't':
break;
case 't':
- consumerd64_bindir = optarg;
+ consumerd64_path = optarg;
+ break;
+ case 'T':
+ consumerd64_libdir = optarg;
break;
default:
/* Unknown option or other error.
break;
default:
/* Unknown option or other error.
@@
-4045,6
+4235,7
@@
int main(int argc, char **argv)
void *status;
const char *home_path;
void *status;
const char *home_path;
+ tracepoint(sessiond_boot_start);
rcu_register_thread();
/* Create thread quit pipe */
rcu_register_thread();
/* Create thread quit pipe */
@@
-4250,6
+4441,8
@@
int main(int argc, char **argv)
goto exit_kernel;
}
goto exit_kernel;
}
+ tracepoint(sessiond_boot_end);
+
ret = pthread_join(kernel_thread, &status);
if (ret != 0) {
perror("pthread_join");
ret = pthread_join(kernel_thread, &status);
if (ret != 0) {
perror("pthread_join");
This page took
0.035387 seconds
and
4
git commands to generate.