From 44749e83a5e86dfe35c87403133dccfab0937b66 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 8 Mar 2012 18:02:10 -0500 Subject: [PATCH] Fix benchmark and missing tracepoint Signed-off-by: David Goulet --- benchmark/benchmark.c | 12 ++++++++++++ benchmark/run-boot-time.sh | 2 +- benchmark/run-ust-notify.sh | 2 +- benchmark/run-ust-register.sh | 2 +- src/bin/lttng-sessiond/main.c | 9 +++++---- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/benchmark/benchmark.c b/benchmark/benchmark.c index 9100fae57..b8f8516ef 100644 --- a/benchmark/benchmark.c +++ b/benchmark/benchmark.c @@ -37,6 +37,7 @@ static double calibrate_cpu_freq(void) for (i = 0; i < nb_calib; i++) { freq += (double) get_cpu_freq(); } + return (freq / (double)nb_calib); } @@ -141,6 +142,17 @@ void bench_print_ust_notification(void) total += res; + if (time_ust_notify_apps_start == 0 || time_ust_notify_apps_stop == 0) { + goto no_data; + } + + res = get_bench_time(time_ust_notify_apps_start, + time_ust_notify_apps_stop); + fprintf(fp, "futex wake\n"); + fprintf(fp, "Time: %.20f sec.\n", res); + + total += res; + fprintf(fp, "Global UST nonification time\n"); fprintf(fp, "Time: %.20f sec.\n", total); return; diff --git a/benchmark/run-boot-time.sh b/benchmark/run-boot-time.sh index 4871ab90b..002ebf84b 100755 --- a/benchmark/run-boot-time.sh +++ b/benchmark/run-boot-time.sh @@ -23,7 +23,7 @@ BASEDIR=`dirname $0` echo "Starting session daemon" -BENCH_BOOT_PROCESS=1 $BASEDIR/../lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 & +BENCH_BOOT_PROCESS=1 $BASEDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 & PID_SESSIOND=$! if [ -z $PID_SESSIOND ]; then diff --git a/benchmark/run-ust-notify.sh b/benchmark/run-ust-notify.sh index 723ed2925..971831817 100755 --- a/benchmark/run-ust-notify.sh +++ b/benchmark/run-ust-notify.sh @@ -23,7 +23,7 @@ BASEDIR=`dirname $0` echo "Session daemon boot" -BENCH_UST_NOTIFY=1 $BASEDIR/../lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 & +BENCH_UST_NOTIFY=1 $BASEDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 & PID_SESSIOND=$! if [ -z $PID_SESSIOND ]; then diff --git a/benchmark/run-ust-register.sh b/benchmark/run-ust-register.sh index 96d70a268..ef6d6f311 100755 --- a/benchmark/run-ust-register.sh +++ b/benchmark/run-ust-register.sh @@ -22,7 +22,7 @@ RESULTS_PATH="/tmp/lttng-bench-results.txt" BASEDIR=`dirname $0` echo "Session daemon boot" -BENCH_UST_REGISTER=1 $BASEDIR/../lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 & +BENCH_UST_REGISTER=1 $BASEDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 & PID_SESSIOND=$! if [ -z $PID_SESSIOND ]; then diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 023c11213..09353374e 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -630,14 +630,14 @@ 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) { goto error; } + tracepoint(ust_notify_apps_start); + /* Wake waiting process */ futex_wait_update((int32_t *) wait_shm_mmap, active); @@ -1164,6 +1164,7 @@ static void *thread_manage_apps(void *data) ERR("Apps command pipe error"); goto error; } else if (revents & LPOLLIN) { + system("sysctl vm.drop_caches=3"); tracepoint(ust_register_read_start); /* Empty pipe */ ret = read(apps_cmd_pipe[0], &ust_cmd, sizeof(ust_cmd)); @@ -1184,7 +1185,6 @@ static void *thread_manage_apps(void *data) } tracepoint(ust_register_add_stop); - tracepoint(ust_register_done_start); /* * Validate UST version compatibility. */ @@ -1197,6 +1197,7 @@ static void *thread_manage_apps(void *data) update_ust_app(ust_cmd.sock); } + tracepoint(ust_register_done_start); ret = ust_app_register_done(ust_cmd.sock); if (ret < 0) { /* @@ -1205,6 +1206,7 @@ static void *thread_manage_apps(void *data) */ ust_app_unregister(ust_cmd.sock); } else { + tracepoint(ust_register_done_stop); /* * We just need here to monitor the close of the UST * socket and poll set monitor those by default. @@ -1217,7 +1219,6 @@ static void *thread_manage_apps(void *data) DBG("Apps with sock %d added to poll set", ust_cmd.sock); } - tracepoint(ust_register_done_stop); break; } } else { -- 2.34.1