X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt-sessiond%2Fmain.c;h=631812cae934c676577e44bd34522addeb756d7e;hb=6e81efd4955d52288a4b5fd462e9e51ca44e3f8f;hp=b636986f832d7352b572c5a08fbcbaf92ceadfc7;hpb=099e26bda04bd3e02eee5b0a17fc0d7f47e3f8ea;p=lttng-tools.git diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index b636986f8..631812cae 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -50,6 +50,8 @@ #include "utils.h" #include "ust-comm.h" +#include "benchmark.h" + /* Const values */ const char default_home_dir[] = DEFAULT_HOME_DIR; const char default_tracing_group[] = LTTNG_DEFAULT_TRACING_GROUP; @@ -254,6 +256,14 @@ static void cleanup(void) DBG("Unloading kernel modules"); modprobe_remove_kernel_modules(); + + /* OUTPUT BENCHMARK RESULTS */ + bench_init(); + + bench_print_boot_process(); + + bench_close(); + /* END BENCHMARK */ } /* @@ -639,6 +649,8 @@ static void *thread_manage_kernel(void *data) char tmp; int update_poll_flag = 1; + tracepoint(sessiond_th_kern_start); + DBG("Thread manage kernel started"); while (1) { @@ -652,6 +664,8 @@ static void *thread_manage_kernel(void *data) DBG("Polling on %d fds", nb_fd); + tracepoint(sessiond_th_kern_poll); + /* Poll infinite value of time */ ret = poll(kernel_pollfd, nb_fd, -1); if (ret < 0) { @@ -720,6 +734,8 @@ static void *thread_manage_kconsumerd(void *data) enum lttcomm_return_code code; struct pollfd pollfd[2]; + tracepoint(sessiond_th_kcon_start); + DBG("[thread] Manage kconsumerd started"); ret = lttcomm_listen_unix_sock(kconsumerd_err_sock); @@ -734,6 +750,8 @@ static void *thread_manage_kconsumerd(void *data) pollfd[1].fd = kconsumerd_err_sock; pollfd[1].events = POLLIN; + tracepoint(sessiond_th_kcon_poll); + /* Inifinite blocking call, waiting for transmission */ ret = poll(pollfd, 2, -1); if (ret < 0) { @@ -1049,6 +1067,18 @@ static void *thread_registration_apps(void *data) */ struct ust_command *ust_cmd = NULL; + tracepoint(sessiond_th_apps_start); + + /* TODO: Something more elegant is needed but fine for now */ + /* FIXME: change all types to either uint8_t, uint32_t, uint64_t + * for 32-bit vs 64-bit compat processes. */ + /* replicate in ust with version number */ + struct { + int reg; /* 1:register, 0:unregister */ + pid_t pid; + uid_t uid; + } reg_msg; + DBG("[thread] Manage application registration started"); ret = lttcomm_listen_unix_sock(apps_sock); @@ -1069,6 +1099,8 @@ static void *thread_registration_apps(void *data) while (1) { DBG("Accepting application registration"); + tracepoint(sessiond_th_apps_poll); + /* Inifinite blocking call, waiting for transmission */ ret = poll(pollfd, 2, -1); if (ret < 0) { @@ -2295,7 +2327,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) goto setup_error; } + tracepoint(create_session_start); ret = create_session(cmd_ctx->lsm->session.name, cmd_ctx->lsm->session.path); + tracepoint(create_session_end); if (ret < 0) { if (ret == -EEXIST) { ret = LTTCOMM_EXIST_SESS; @@ -2319,7 +2353,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) /* Clean kernel session teardown */ teardown_kernel_session(cmd_ctx->session); + tracepoint(destroy_session_start); ret = destroy_session(cmd_ctx->lsm->session.name); + tracepoint(destroy_session_end); if (ret < 0) { ret = LTTCOMM_FATAL; goto error; @@ -2555,6 +2591,8 @@ static void *thread_manage_clients(void *data) struct command_ctx *cmd_ctx = NULL; struct pollfd pollfd[2]; + tracepoint(sessiond_th_cli_start); + DBG("[thread] Manage client started"); ret = lttcomm_listen_unix_sock(client_sock); @@ -2579,6 +2617,8 @@ static void *thread_manage_clients(void *data) while (1) { DBG("Accepting client command ..."); + tracepoint(sessiond_th_cli_poll); + /* Inifinite blocking call, waiting for transmission */ ret = poll(pollfd, 2, -1); if (ret < 0) { @@ -3058,6 +3098,8 @@ int main(int argc, char **argv) void *status; const char *home_path; + tracepoint(sessiond_boot_start); + /* Create thread quit pipe */ if ((ret = init_thread_quit_pipe()) < 0) { goto error; @@ -3229,6 +3271,8 @@ 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");