From: David Goulet Date: Thu, 8 Dec 2011 17:24:11 +0000 (-0500) Subject: Merge branch 'master' into benchmark X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=23bae352fa0d6626a022412dcba8eecb2373f3be;hp=-c;p=lttng-tools.git Merge branch 'master' into benchmark --- 23bae352fa0d6626a022412dcba8eecb2373f3be diff --combined configure.ac index d259b290c,f5e4c366a..e4084aed3 --- a/configure.ac +++ b/configure.ac @@@ -14,36 -14,36 +14,36 @@@ AC_CHECK_HEADERS([ getopt.h sys/ipc.h sys/shm.h popt.h grp.h \ ]) - AC_ARG_WITH([consumerd32-path], - AS_HELP_STRING([--with-consumerd32-path], - [Location of the 32-bit consumerd executable]), - [CONSUMERD32_PATH="$withval"], - [CONSUMERD32_PATH='']) - AC_SUBST([CONSUMERD32_PATH]) + AC_ARG_WITH([consumerd32-bin], + AS_HELP_STRING([--with-consumerd32-bin], + [Location of the 32-bit consumerd executable (including the filename)]), + [CONSUMERD32_BIN="$withval"], + [CONSUMERD32_BIN='']) + AC_SUBST([CONSUMERD32_BIN]) - AC_ARG_WITH([consumerd64-path], - AS_HELP_STRING([--with-consumerd64-path], - [Location of the 64-bit consumerd executable]), - [CONSUMERD64_PATH="$withval"], - [CONSUMERD64_PATH='']) - AC_SUBST([CONSUMERD64_PATH]) + AC_ARG_WITH([consumerd64-bin], + AS_HELP_STRING([--with-consumerd64-bin], + [Location of the 64-bit consumerd executable (including the filename)]), + [CONSUMERD64_BIN="$withval"], + [CONSUMERD64_BIN='']) + AC_SUBST([CONSUMERD64_BIN]) AC_ARG_WITH([consumerd32-libdir], AS_HELP_STRING([--with-consumerd32-libdir], - [Location of the 32-bit consumerd libraries]), + [Directory containing the 32-bit consumerd libraries]), [CONSUMERD32_LIBDIR="$withval"], [CONSUMERD32_LIBDIR='']) AC_SUBST([CONSUMERD32_LIBDIR]) AC_ARG_WITH([consumer64d-libdir], AS_HELP_STRING([--with-consumerd64-libdir], - [Location of the 64-bit consumerd libraries]), + [Directory containing the 64-bit consumerd libraries]), [CONSUMERD64_LIBDIR="$withval"], [CONSUMERD64_LIBDIR='']) AC_SUBST([CONSUMERD64_LIBDIR]) - AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_PATH], $CONSUMERD32_PATH, [Location of the 32-bit consumerd executable.]) - AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_PATH], $CONSUMERD64_PATH, [Location of the 64-bit consumerd executable]) + AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], $CONSUMERD32_BIN, [Location of the 32-bit consumerd executable.]) + AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], $CONSUMERD64_BIN, [Location of the 64-bit consumerd executable]) AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], $CONSUMERD32_LIBDIR, [Search for consumerd 32-bit libraries in this location.]) AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_LIBDIR], $CONSUMERD64_LIBDIR, [Search for consumerd 64-bit libraries in this location.]) @@@ -57,11 -57,6 +57,11 @@@ AC_CHECK_LIB([popt], [poptGetContext], [AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])] ) +# Needed for benchmark time +AC_CHECK_DECL([caa_get_cycles], [], + [AC_MSG_ERROR([liburcu liburcu_version or newer is needed])], [[#include ]] +) + # URCU library version needed or newer liburcu_version=">= 0.6.6" @@@ -137,7 -132,6 +137,7 @@@ AC_SUBST(DEFAULT_INCLUDES AC_CONFIG_FILES([ Makefile include/Makefile + benchmark/Makefile libkernelctl/Makefile liblttng-consumer/Makefile liblttng-kconsumer/Makefile diff --combined lttng-sessiond/main.c index 6f9ee8dc4,ec45c6676..f4f69969b --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@@ -77,8 -77,6 +77,8 @@@ struct consumer_data 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; @@@ -173,10 -171,10 +173,10 @@@ static struct ltt_session_list *session int ust_consumerd64_fd = -1; int ust_consumerd32_fd = -1; - static const char *consumerd32_path = - __stringify(CONFIG_CONSUMERD32_PATH); - static const char *consumerd64_path = - __stringify(CONFIG_CONSUMERD64_PATH); + static const char *consumerd32_bin = + __stringify(CONFIG_CONSUMERD32_BIN); + static const char *consumerd64_bin = + __stringify(CONFIG_CONSUMERD64_BIN); static const char *consumerd32_libdir = __stringify(CONFIG_CONSUMERD32_LIBDIR); static const char *consumerd64_libdir = @@@ -185,7 -183,7 +185,7 @@@ static void setup_consumerd_path(void) { - const char *path, *libdir; + const char *bin, *libdir; /* * Allow INSTALL_BIN_PATH to be used as a target path for the @@@ -193,15 -191,15 +193,15 @@@ * has not been defined. */ #if (CAA_BITS_PER_LONG == 32) - if (!consumerd32_path[0]) { - consumerd32_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE; + if (!consumerd32_bin[0]) { + consumerd32_bin = INSTALL_BIN_PATH "/" CONSUMERD_FILE; } 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_bin[0]) { + consumerd64_bin = INSTALL_BIN_PATH "/" CONSUMERD_FILE; } if (!consumerd64_libdir[0]) { consumerd64_libdir = INSTALL_LIB_PATH; @@@ -213,13 -211,13 +213,13 @@@ /* * runtime env. var. overrides the build default. */ - path = getenv("LTTNG_CONSUMERD32_PATH"); - if (path) { - consumerd32_path = path; + bin = getenv("LTTNG_CONSUMERD32_BIN"); + if (bin) { + consumerd32_bin = bin; } - path = getenv("LTTNG_CONSUMERD64_PATH"); - if (path) { - consumerd64_path = path; + bin = getenv("LTTNG_CONSUMERD64_BIN"); + if (bin) { + consumerd64_bin = bin; } libdir = getenv("LTTNG_TOOLS_CONSUMERD32_LIBDIR"); if (libdir) { @@@ -470,25 -468,6 +470,25 @@@ static void cleanup(void 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 */ + /* */ MSG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm" "Matthew, BEET driven development works!%c[%dm", @@@ -665,8 -644,6 +665,8 @@@ static int notify_ust_apps(int 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) { @@@ -676,8 -653,6 +676,8 @@@ /* Wake waiting process */ futex_wait_update((int32_t *) wait_shm_mmap, active); + tracepoint(ust_notify_apps_stop); + /* Apps notified successfully */ return 0; @@@ -849,8 -824,6 +849,8 @@@ static void *thread_manage_kernel(void char tmp; struct lttng_poll_event events; + tracepoint(sessiond_th_kern_start); + DBG("Thread manage kernel started"); ret = create_thread_poll_set(&events, 2); @@@ -885,8 -858,6 +885,8 @@@ /* 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) { @@@ -955,8 -926,6 +955,8 @@@ static void *thread_manage_consumer(voi 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); @@@ -980,8 -949,6 +980,8 @@@ 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) { @@@ -1114,8 -1081,6 +1114,8 @@@ static void *thread_manage_apps(void *d struct ust_command ust_cmd; struct lttng_poll_event events; + tracepoint(sessiond_th_apps_start); + DBG("[thread] Manage application started"); rcu_register_thread(); @@@ -1139,8 -1104,6 +1139,8 @@@ 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) { @@@ -1164,16 -1127,13 +1164,16 @@@ 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; } + 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); @@@ -1182,9 -1142,7 +1182,9 @@@ } 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. @@@ -1211,7 -1169,7 +1211,7 @@@ DBG("Apps with sock %d added to poll set", ust_cmd.sock); } - + tracepoint(ust_register_done_stop); break; } } else { @@@ -1220,8 -1178,6 +1220,8 @@@ * the event at poll_wait. */ if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) { + tracepoint(ust_unregister_start); + /* Removing from the poll set */ ret = lttng_poll_del(&events, pollfd); if (ret < 0) { @@@ -1230,8 -1186,6 +1230,8 @@@ /* Socket closed on remote end. */ ust_app_unregister(pollfd); + + tracepoint(ust_unregister_stop); break; } } @@@ -1260,8 -1214,6 +1260,8 @@@ static void *thread_dispatch_ust_regist 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) { @@@ -1269,8 -1221,6 +1269,8 @@@ 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) { @@@ -1279,8 -1229,6 +1279,8 @@@ 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" @@@ -1311,8 -1259,6 +1311,8 @@@ 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); } @@@ -1336,8 -1282,6 +1336,8 @@@ static void *thread_registration_apps(v */ struct ust_command *ust_cmd = NULL; + tracepoint(sessiond_th_reg_start); + DBG("[thread] Manage application registration started"); ret = lttcomm_listen_unix_sock(apps_sock); @@@ -1371,8 -1315,6 +1371,8 @@@ while (1) { DBG("Accepting application registration"); + tracepoint(sessiond_th_reg_poll); + nb_fd = LTTNG_POLL_GETNB(&events); /* Inifinite blocking call, waiting for transmission */ @@@ -1398,9 -1340,6 +1398,9 @@@ 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; @@@ -1450,8 -1389,6 +1450,8 @@@ * barrier with the exchange in cds_wfq_enqueue. */ futex_nto1_wake(&ust_cmd_queue.futex); + + tracepoint(ust_register_stop); } } } @@@ -1571,7 -1508,9 +1571,9 @@@ static pid_t spawn_consumerd(struct con { int ret; pid_t pid; + const char *consumer_to_use; const char *verbosity; + struct stat st; DBG("Spawning consumerd"); @@@ -1587,11 -1526,27 +1589,27 @@@ } switch (consumer_data->type) { case LTTNG_CONSUMER_KERNEL: - execl(INSTALL_BIN_PATH "/lttng-consumerd", - "lttng-consumerd", verbosity, "-k", - "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path, - "--consumerd-err-sock", consumer_data->err_unix_sock_path, - NULL); + /* + * Find out which consumerd to execute. We will + * first try the 64-bit path, then the + * sessiond's installation directory, and + * fallback on the 32-bit one, + */ + if (stat(consumerd64_bin, &st) == 0) { + consumer_to_use = consumerd64_bin; + } else if (stat(INSTALL_BIN_PATH "/" CONSUMERD_FILE, &st) == 0) { + consumer_to_use = INSTALL_BIN_PATH "/" CONSUMERD_FILE; + } else if (stat(consumerd32_bin, &st) == 0) { + consumer_to_use = consumerd32_bin; + } else { + break; + } + DBG("Using kernel consumer at: %s", consumer_to_use); + execl(consumer_to_use, + "lttng-consumerd", verbosity, "-k", + "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path, + "--consumerd-err-sock", consumer_data->err_unix_sock_path, + NULL); break; case LTTNG_CONSUMER64_UST: { @@@ -1624,7 -1579,8 +1642,8 @@@ goto error; } } - ret = execl(consumerd64_path, verbosity, "-u", + DBG("Using 64-bit UST consumer at: %s", consumerd64_bin); + ret = execl(consumerd64_bin, verbosity, "-u", "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path, "--consumerd-err-sock", consumer_data->err_unix_sock_path, NULL); @@@ -1667,7 -1623,8 +1686,8 @@@ goto error; } } - ret = execl(consumerd32_path, verbosity, "-u", + DBG("Using 32-bit UST consumer at: %s", consumerd32_bin); + ret = execl(consumerd32_bin, verbosity, "-u", "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path, "--consumerd-err-sock", consumer_data->err_unix_sock_path, NULL); @@@ -2137,9 -2094,7 +2157,7 @@@ static int list_lttng_ust_global_events tmp[i].type = LTTNG_EVENT_FUNCTION; break; case LTTNG_UST_TRACEPOINT_LOGLEVEL: - /* TODO */ - ret = -LTTCOMM_NOT_IMPLEMENTED; - goto error; + tmp[i].type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL; break; } i++; @@@ -2250,29 -2205,20 +2268,20 @@@ static int cmd_disable_channel(struct l case LTTNG_DOMAIN_UST: { struct ltt_ust_channel *uchan; + struct cds_lfht *chan_ht; - /* Get channel in global UST domain HT */ - uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, - channel_name); + chan_ht = usess->domain_global.channels; + + uchan = trace_ust_find_channel_by_name(chan_ht, channel_name); if (uchan == NULL) { ret = LTTCOMM_UST_CHAN_NOT_FOUND; goto error; } - /* 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; + ret = channel_ust_disable(usess, domain, uchan); + if (ret != LTTCOMM_OK) { goto error; } - - uchan->enabled = 0; - break; } case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: @@@ -2291,40 -2237,6 +2300,6 @@@ error return ret; } - /* - * Copy channel from attributes and set it in the application channel list. - */ - /* - static int copy_ust_channel_to_app(struct ltt_ust_session *usess, - struct lttng_channel *attr, struct ust_app *app) - { - int ret; - struct ltt_ust_channel *uchan, *new_chan; - - uchan = trace_ust_get_channel_by_key(usess->channels, attr->name); - if (uchan == NULL) { - ret = LTTCOMM_FATAL; - goto error; - } - - new_chan = trace_ust_create_channel(attr, usess->path); - if (new_chan == NULL) { - PERROR("malloc ltt_ust_channel"); - ret = LTTCOMM_FATAL; - goto error; - } - - ret = channel_ust_copy(new_chan, uchan); - if (ret < 0) { - ret = LTTCOMM_FATAL; - goto error; - } - - error: - return ret; - } - */ - /* * Command LTTNG_ENABLE_CHANNEL processed by the client thread. */ @@@ -2333,6 -2245,7 +2308,7 @@@ static int cmd_enable_channel(struct lt { int ret; struct ltt_ust_session *usess = session->ust_session; + struct cds_lfht *chan_ht; DBG("Enabling channel %s for session %s", attr->name, session->name); @@@ -2361,49 -2274,14 +2337,14 @@@ { struct ltt_ust_channel *uchan; - DBG2("Enabling channel for LTTNG_DOMAIN_UST"); + chan_ht = usess->domain_global.channels; - /* Get channel in global UST domain HT */ - uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, - attr->name); + uchan = trace_ust_find_channel_by_name(chan_ht, attr->name); if (uchan == NULL) { - uchan = trace_ust_create_channel(attr, usess->pathname); - if (uchan == NULL) { - ret = LTTCOMM_UST_CHAN_FAIL; - goto error; - } - - /* Add channel to all registered applications */ - ret = ust_app_create_channel_glb(usess, uchan); - 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); + ret = channel_ust_create(usess, domain, attr); } else { - /* If already enabled, everything is OK */ - if (uchan->enabled) { - break; - } - - ret = ust_app_enable_channel_glb(usess, uchan); - if (ret < 0) { - if (ret != -EEXIST) { - ret = LTTCOMM_UST_CHAN_ENABLE_FAIL; - goto error; - } else { - ret = LTTCOMM_OK; - } - } + ret = channel_ust_enable(usess, domain, uchan); } - - uchan->enabled = 1; - break; } case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: @@@ -2416,8 -2294,6 +2357,6 @@@ goto error; } - ret = LTTCOMM_OK; - error: return ret; } @@@ -2454,9 -2330,8 +2393,8 @@@ static int cmd_disable_event(struct ltt } case LTTNG_DOMAIN_UST: { - struct ltt_ust_session *usess; struct ltt_ust_channel *uchan; - struct ltt_ust_event *uevent; + struct ltt_ust_session *usess; usess = session->ust_session; @@@ -2467,23 -2342,13 +2405,13 @@@ 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; + ret = event_ust_disable_tracepoint(usess, domain, uchan, event_name); + if (ret != LTTCOMM_OK) { goto error; } - uevent->enabled = 0; - - DBG2("Disable UST event %s in channel %s completed", event_name, + DBG3("Disable UST event %s in channel %s completed", event_name, channel_name); - break; } case LTTNG_DOMAIN_UST_EXEC_NAME: @@@ -2544,13 -2409,12 +2472,12 @@@ static int cmd_disable_event_all(struc goto error; } - ret = ust_app_disable_all_event_glb(usess, uchan); - if (ret < 0) { - ret = LTTCOMM_UST_DISABLE_FAIL; + ret = event_ust_disable_all_tracepoints(usess, domain, uchan); + if (ret != 0) { goto error; } - DBG2("Disable all UST event in channel %s completed", channel_name); + DBG3("Disable all UST events in channel %s completed", channel_name); break; } @@@ -2611,6 -2475,12 +2538,12 @@@ error /* * Command LTTNG_ENABLE_EVENT processed by the client thread. + * + * TODO: currently, both events and loglevels are kept within the same + * namespace for UST global registry/app registery, so if an event + * happen to have the same name as the loglevel (very unlikely though), + * and an attempt is made to enable/disable both in the same session, + * the first to be created will be the only one allowed to exist. */ static int cmd_enable_event(struct ltt_session *session, int domain, char *channel_name, struct lttng_event *event) @@@ -2680,8 -2550,7 +2613,7 @@@ 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); + ret = channel_ust_create(usess, domain, attr); if (ret != LTTCOMM_OK) { free(attr); goto error; @@@ -2753,11 -2622,11 +2685,11 @@@ static int cmd_enable_event_all(struct } switch (event_type) { - case LTTNG_KERNEL_SYSCALL: + case LTTNG_EVENT_SYSCALL: ret = event_kernel_enable_all_syscalls(session->kernel_session, kchan, kernel_tracer_fd); break; - case LTTNG_KERNEL_TRACEPOINT: + case LTTNG_EVENT_TRACEPOINT: /* * This call enables all LTTNG_KERNEL_TRACEPOINTS and * events already registered to the channel. @@@ -2765,7 -2634,7 +2697,7 @@@ ret = event_kernel_enable_all_tracepoints(session->kernel_session, kchan, kernel_tracer_fd); break; - case LTTNG_KERNEL_ALL: + case LTTNG_EVENT_ALL: /* Enable syscalls and tracepoints */ ret = event_kernel_enable_all(session->kernel_session, kchan, kernel_tracer_fd); @@@ -2782,8 -2651,69 +2714,69 @@@ kernel_wait_quiescent(kernel_tracer_fd); break; + case LTTNG_DOMAIN_UST: + { + struct lttng_channel *attr; + struct ltt_ust_channel *uchan; + struct ltt_ust_session *usess = session->ust_session; + + /* Get channel from global UST domain */ + uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, + channel_name); + if (uchan == NULL) { + /* Create default channel */ + attr = channel_new_default_attr(domain); + if (attr == NULL) { + ret = LTTCOMM_FATAL; + goto error; + } + snprintf(attr->name, NAME_MAX, "%s", channel_name); + attr->name[NAME_MAX - 1] = '\0'; + + /* Use the internal command enable channel */ + ret = channel_ust_create(usess, domain, attr); + if (ret != LTTCOMM_OK) { + free(attr); + goto error; + } + free(attr); + + /* Get the newly created channel reference back */ + uchan = trace_ust_find_channel_by_name( + usess->domain_global.channels, channel_name); + if (uchan == NULL) { + /* Something is really wrong */ + ret = LTTCOMM_FATAL; + goto error; + } + } + + /* At this point, the session and channel exist on the tracer */ + + switch (event_type) { + case LTTNG_EVENT_ALL: + case LTTNG_EVENT_TRACEPOINT: + ret = event_ust_enable_all_tracepoints(usess, domain, uchan); + if (ret != LTTCOMM_OK) { + goto error; + } + break; + default: + ret = LTTCOMM_UST_ENABLE_FAIL; + goto error; + } + + /* Manage return value */ + if (ret != LTTCOMM_OK) { + goto error; + } + + break; + } + case LTTNG_DOMAIN_UST_EXEC_NAME: + case LTTNG_DOMAIN_UST_PID: + case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: default: - /* TODO: Userspace tracing */ ret = LTTCOMM_NOT_IMPLEMENTED; goto error; } @@@ -3328,7 -3258,7 +3321,7 @@@ static int process_client_msg(struct co /* Start the UST consumer daemons */ /* 64-bit */ pthread_mutex_lock(&ustconsumer64_data.pid_mutex); - if (consumerd64_path[0] != '\0' && + if (consumerd64_bin[0] != '\0' && ustconsumer64_data.pid == 0 && cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) { pthread_mutex_unlock(&ustconsumer64_data.pid_mutex); @@@ -3344,7 -3274,7 +3337,7 @@@ pthread_mutex_unlock(&ustconsumer64_data.pid_mutex); } /* 32-bit */ - if (consumerd32_path[0] != '\0' && + if (consumerd32_bin[0] != '\0' && ustconsumer32_data.pid == 0 && cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) { pthread_mutex_unlock(&ustconsumer32_data.pid_mutex); @@@ -3461,18 -3391,14 +3454,18 @@@ } case LTTNG_CREATE_SESSION: { + tracepoint(create_session_start); ret = cmd_create_session(cmd_ctx->lsm->session.name, cmd_ctx->lsm->session.path); + tracepoint(create_session_end); break; } case LTTNG_DESTROY_SESSION: { + tracepoint(destroy_session_start); ret = cmd_destroy_session(cmd_ctx->session, cmd_ctx->lsm->session.name); + tracepoint(destroy_session_end); break; } case LTTNG_LIST_DOMAINS: @@@ -3622,8 -3548,6 +3615,8 @@@ static void *thread_manage_clients(voi struct command_ctx *cmd_ctx = NULL; struct lttng_poll_event events; + tracepoint(sessiond_th_cli_start); + DBG("[thread] Manage client started"); rcu_register_thread(); @@@ -3658,8 -3582,6 +3651,8 @@@ while (1) { DBG("Accepting client command ..."); + tracepoint(sessiond_th_cli_poll); + nb_fd = LTTNG_POLL_GETNB(&events); /* Inifinite blocking call, waiting for transmission */ @@@ -3901,13 -3823,13 +3894,13 @@@ static int parse_args(int argc, char ** opt_verbose_consumer += 1; break; case 'u': - consumerd32_path= optarg; + consumerd32_bin= optarg; break; case 'U': consumerd32_libdir = optarg; break; case 't': - consumerd64_path = optarg; + consumerd64_bin = optarg; break; case 'T': consumerd64_libdir = optarg; @@@ -4239,7 -4161,6 +4232,7 @@@ int main(int argc, char **argv void *status; const char *home_path; + tracepoint(sessiond_boot_start); rcu_register_thread(); /* Create thread quit pipe */ @@@ -4445,8 -4366,6 +4438,8 @@@ goto exit_kernel; } + tracepoint(sessiond_boot_end); + ret = pthread_join(kernel_thread, &status); if (ret != 0) { perror("pthread_join");