static double calibrate_cpu_freq(void)
{
int i, nb_calib = 10;
- double freq;
+ double freq = 0;
printf("CPU frequency calibration, this should take 10 seconds\n");
return get_bench_time(time_destroy_session_start, time_destroy_session_end);
}
+void bench_print_create_session(void)
+{
+ fprintf(fp, "Create session time:\n");
+ fprintf(fp, " %.20f sec.\n", bench_get_create_session());
+}
+
+void bench_print_enable_ust_channel(void)
+{
+ double res;
+
+ if ((time_enable_ust_channel_start == 0) &&
+ (time_enable_ust_channel_end == 0)) {
+ fprintf(fp, "NO DATA\n");
+ return;
+ }
+
+ res = get_bench_time(time_enable_ust_channel_start,
+ time_enable_ust_channel_end);
+ fprintf(fp, "Enable lttng-ust channel time:\n");
+ fprintf(fp, " %.20f sec.\n", res);
+}
+
+void bench_print_enable_ust_event(void)
+{
+ double res;
+
+ if ((time_enable_ust_event_start== 0) &&
+ (time_enable_ust_event_end == 0)) {
+ fprintf(fp, "NO DATA\n");
+ return;
+ }
+
+ res = get_bench_time(time_enable_ust_event_start,
+ time_enable_ust_event_end);
+ fprintf(fp, "Enable lttng-ust event time:\n");
+ fprintf(fp, " %.20f sec.\n", res);
+}
+
+void bench_print_start_ust(void)
+{
+ double res;
+
+ if ((time_start_ust_start== 0) && (time_start_ust_end == 0)) {
+ fprintf(fp, "NO DATA\n");
+ return;
+ }
+
+ res = get_bench_time(time_start_ust_start, time_start_ust_end);
+ fprintf(fp, "Start lttng-ust tracing time:\n");
+ fprintf(fp, " %.20f sec.\n", res);
+}
+
/*
* Complete UST notification process time break down in different actions.
*/
void bench_init(void);
void bench_close(void);
+
+void bench_print_create_session(void);
+void bench_print_enable_ust_event(void);
+void bench_print_enable_ust_channel(void);
+void bench_print_start_ust(void);
+
void bench_print_boot_process(void);
void bench_print_ust_register(void);
void bench_print_ust_unregister(void);
void bench_print_ust_notification(void);
+
double bench_get_create_session(void);
double bench_get_destroy_session(void);
cycles_t time_destroy_session_start;
cycles_t time_destroy_session_end;
+/* Enable an UST channel values */
+cycles_t time_enable_ust_channel_start;
+cycles_t time_enable_ust_channel_end;
+
+/* Enable an UST event values */
+cycles_t time_enable_ust_event_start;
+cycles_t time_enable_ust_event_end;
+
+/* Start UST tracing */
+cycles_t time_start_ust_start;
+cycles_t time_start_ust_end;
+
/*
* UST registration time
*
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+SESSIOND_BIN="lttng-sessiond"
+RESULTS_PATH="/tmp/lttng-bench-results.txt"
+BASEDIR=`dirname $0`
+
+echo "Session daemon boot"
+#BENCH_COMMANDS=1 $BASEDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN -v >/dev/null 2>&1 &
+
+#PID_SESSIOND=$!
+#if [ -z $PID_SESSIOND ]; then
+# echo -e '\e[1;31mFAILED\e[0m'
+# exit 1
+#else
+# echo -e "\e[1;32mOK\e[0m"
+# echo "PID session daemon: $PID_SESSIOND"
+#fi
+
+# Session daemon need to boot up and run benchmark
+echo -n "Waiting."
+sleep 1
+echo -n "."
+sleep 1
+echo "."
+sleep 1
+
+# Start libust instrumented application to register.
+for i in `seq 100`; do
+ echo -n "."
+ ./$BASEDIR/hello &
+done
+echo ""
+
+echo "Input when ready"
+read -n 1
+
+# We measure these commands
+lttng create test1
+lttng create test2
+lttng create test3
+lttng create test4
+lttng enable-channel chan1 -u -s test1
+lttng enable-channel chan1 -u -s test2
+lttng enable-channel chan1 -u -s test3
+lttng enable-channel chan1 -u -s test4
+lttng enable-channel chan2 -u -s test1
+lttng enable-channel chan2 -u -s test2
+lttng enable-channel chan2 -u -s test3
+lttng enable-channel chan2 -u -s test4
+lttng enable-channel chan3 -u -s test1
+lttng enable-channel chan3 -u -s test2
+lttng enable-channel chan3 -u -s test3
+lttng enable-channel chan3 -u -s test4
+lttng enable-channel chan4 -u -s test1
+lttng enable-channel chan4 -u -s test2
+lttng enable-channel chan4 -u -s test3
+lttng enable-channel chan4 -u -s test4
+lttng enable-event -a -u -c chan1 -s test1
+lttng enable-event -a -u -c chan1 -s test2
+lttng enable-event -a -u -c chan1 -s test3
+lttng enable-event -a -u -c chan1 -s test4
+lttng start test1
+lttng start test2
+lttng start test3
+lttng start test4
+
+#kill $PID_SESSIOND
+#wait $PID_SESSIOND
+
+killall hello
+
+echo "Benchmarks done in $RESULTS_PATH"
+
+exit 0
if (ret) {
PERROR("close");
}
-
+
}
}
for (i = 0; i < 2; i++) {
}
/* OUTPUT BENCHMARK RESULTS */
- bench_init();
+ //bench_init();
if (getenv("BENCH_UST_NOTIFY")) {
bench_print_ust_notification();
bench_print_boot_process();
}
+ if (getenv("BENCH_COMMANDS")) {
+ bench_print_enable_ust_event();
+ }
+
bench_close();
/* END BENCHMARK */
}
case LTTNG_ENABLE_CHANNEL:
{
+ tracepoint(enable_ust_channel_start);
ret = cmd_enable_channel(cmd_ctx->session, cmd_ctx->lsm->domain.type,
&cmd_ctx->lsm->u.channel.chan);
+ tracepoint(enable_ust_channel_end);
+ bench_print_enable_ust_channel();
break;
}
case LTTNG_ENABLE_EVENT:
{
+ tracepoint(enable_ust_event_start);
ret = cmd_enable_event(cmd_ctx->session, cmd_ctx->lsm->domain.type,
cmd_ctx->lsm->u.enable.channel_name,
&cmd_ctx->lsm->u.enable.event);
+ tracepoint(enable_ust_event_end);
break;
}
case LTTNG_ENABLE_ALL_EVENT:
{
DBG("Enabling all events");
+ tracepoint(enable_ust_event_start);
ret = cmd_enable_event_all(cmd_ctx->session, cmd_ctx->lsm->domain.type,
cmd_ctx->lsm->u.enable.channel_name,
cmd_ctx->lsm->u.enable.event.type);
+ tracepoint(enable_ust_event_end);
break;
}
case LTTNG_LIST_TRACEPOINTS:
}
case LTTNG_START_TRACE:
{
+ tracepoint(start_ust_start);
ret = cmd_start_trace(cmd_ctx->session);
+ tracepoint(start_ust_end);
+ bench_print_start_ust();
break;
}
case LTTNG_STOP_TRACE:
ret = cmd_create_session(cmd_ctx->lsm->session.name,
cmd_ctx->lsm->session.path, &cmd_ctx->creds);
tracepoint(create_session_end);
+ bench_print_create_session();
break;
}
case LTTNG_DESTROY_SESSION:
/* Set up max poll set size */
lttng_poll_set_max_size();
+ bench_init();
+
/* Create thread to manage the client socket */
ret = pthread_create(&client_thread, NULL,
thread_manage_clients, (void *) NULL);