Commit | Line | Data |
---|---|---|
e72d66a6 DG |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2012 David Goulet <dgoulet@efficios.com> |
e72d66a6 | 4 | # |
9d16b343 MJ |
5 | # SPDX-License-Identifier: LGPL-2.1-only |
6 | ||
c38b5107 | 7 | TEST_DESC="UST tracer - Testing high events throughput" |
e72d66a6 DG |
8 | |
9 | CURDIR=$(dirname $0)/ | |
9ac429ef | 10 | TESTDIR=$CURDIR/../../.. |
6950d621 | 11 | NR_APP=20 |
e72d66a6 DG |
12 | BIN_NAME="gen-events" |
13 | SESSION_NAME="high-throughput" | |
14 | EVENT_NAME="tp:tptest" | |
6950d621 | 15 | NUM_TESTS=9 |
e72d66a6 | 16 | |
9ac429ef | 17 | source $TESTDIR/utils/utils.sh |
e72d66a6 | 18 | |
8acbe07d | 19 | if [ ! -x "$CURDIR/$BIN_NAME" ]; then |
6950d621 | 20 | BAIL_OUT "No UST nevents binary detected." |
e72d66a6 DG |
21 | fi |
22 | ||
23 | TRACE_PATH=$(mktemp -d) | |
24 | ||
25 | # MUST set TESTDIR before calling those functions | |
26 | ||
6950d621 CB |
27 | plan_tests $NUM_TESTS |
28 | ||
e3bef725 CB |
29 | print_test_banner "$TEST_DESC" |
30 | ||
fb3268e3 | 31 | start_lttng_sessiond |
e72d66a6 | 32 | |
bf6ae429 | 33 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
e72d66a6 | 34 | |
c4926bb5 | 35 | enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME |
e563bbdb | 36 | start_lttng_tracing_ok $SESSION_NAME |
e72d66a6 | 37 | |
6950d621 | 38 | for i in `seq 1 $NR_APP`; do |
c7613334 | 39 | ./$CURDIR/$BIN_NAME >/dev/null 2>&1 & |
e72d66a6 DG |
40 | done |
41 | ||
5dca3876 MD |
42 | diag "Waiting for applications to end" |
43 | wait | |
44 | pass "Wait for applications to end" | |
e72d66a6 | 45 | |
96340a01 | 46 | stop_lttng_tracing_ok $SESSION_NAME |
67b4c664 | 47 | destroy_lttng_session_ok $SESSION_NAME |
e72d66a6 | 48 | |
fb3268e3 | 49 | stop_lttng_sessiond |
e72d66a6 DG |
50 | |
51 | # Validate test | |
52 | ||
53 | TEMP_FILE=$(mktemp) | |
54 | TEMP_FILE_2=$(mktemp) | |
55 | ||
56 | traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) | |
57 | babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 | |
58 | ||
59 | cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE | |
60 | ||
61 | dropped=0 | |
62 | while read line; | |
63 | do | |
64 | let dropped=$dropped+$line | |
65 | done < $TEMP_FILE | |
66 | ||
67 | let total=$dropped+$traced | |
6950d621 | 68 | let wanted=$NR_APP*1000000 |
e72d66a6 DG |
69 | |
70 | if [ $wanted -ne $total ]; then | |
6950d621 CB |
71 | fail "Trace validation" |
72 | diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total" | |
e72d66a6 | 73 | else |
6950d621 CB |
74 | pass "Trace validation" |
75 | diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total" | |
e72d66a6 DG |
76 | fi |
77 | ||
78 | rm -rf $TRACE_PATH | |
79 | rm $TEMP_FILE $TEMP_FILE_2 |