Commit | Line | Data |
---|---|---|
e72d66a6 DG |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2012 David Goulet <dgoulet@efficios.com> | |
4 | # | |
5 | # This library is free software; you can redistribute it and/or modify it under | |
6 | # the terms of the GNU Lesser General Public License as published by the Free | |
7 | # Software Foundation; version 2.1 of the License. | |
8 | # | |
9 | # This library is distributed in the hope that it will be useful, but WITHOUT | |
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
11 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
12 | # details. | |
13 | # | |
14 | # You should have received a copy of the GNU Lesser General Public License | |
15 | # along with this library; if not, write to the Free Software Foundation, Inc., | |
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
c38b5107 | 17 | TEST_DESC="UST tracer - Testing high events throughput" |
e72d66a6 DG |
18 | |
19 | CURDIR=$(dirname $0)/ | |
9ac429ef | 20 | TESTDIR=$CURDIR/../../.. |
6950d621 | 21 | NR_APP=20 |
e72d66a6 DG |
22 | BIN_NAME="gen-events" |
23 | SESSION_NAME="high-throughput" | |
24 | EVENT_NAME="tp:tptest" | |
6950d621 | 25 | NUM_TESTS=9 |
e72d66a6 | 26 | |
9ac429ef | 27 | source $TESTDIR/utils/utils.sh |
e72d66a6 | 28 | |
8acbe07d | 29 | if [ ! -x "$CURDIR/$BIN_NAME" ]; then |
6950d621 | 30 | BAIL_OUT "No UST nevents binary detected." |
e72d66a6 DG |
31 | fi |
32 | ||
33 | TRACE_PATH=$(mktemp -d) | |
34 | ||
35 | # MUST set TESTDIR before calling those functions | |
36 | ||
6950d621 CB |
37 | plan_tests $NUM_TESTS |
38 | ||
e3bef725 CB |
39 | print_test_banner "$TEST_DESC" |
40 | ||
fb3268e3 | 41 | start_lttng_sessiond |
e72d66a6 | 42 | |
bf6ae429 | 43 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
e72d66a6 | 44 | |
c4926bb5 | 45 | enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME |
fb3268e3 | 46 | start_lttng_tracing $SESSION_NAME |
e72d66a6 | 47 | |
6950d621 | 48 | for i in `seq 1 $NR_APP`; do |
c7613334 | 49 | ./$CURDIR/$BIN_NAME >/dev/null 2>&1 & |
e72d66a6 DG |
50 | done |
51 | ||
5dca3876 MD |
52 | diag "Waiting for applications to end" |
53 | wait | |
54 | pass "Wait for applications to end" | |
e72d66a6 | 55 | |
fb3268e3 | 56 | stop_lttng_tracing $SESSION_NAME |
e72d66a6 DG |
57 | destroy_lttng_session $SESSION_NAME |
58 | ||
fb3268e3 | 59 | stop_lttng_sessiond |
e72d66a6 DG |
60 | |
61 | # Validate test | |
62 | ||
63 | TEMP_FILE=$(mktemp) | |
64 | TEMP_FILE_2=$(mktemp) | |
65 | ||
66 | traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) | |
67 | babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 | |
68 | ||
69 | cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE | |
70 | ||
71 | dropped=0 | |
72 | while read line; | |
73 | do | |
74 | let dropped=$dropped+$line | |
75 | done < $TEMP_FILE | |
76 | ||
77 | let total=$dropped+$traced | |
6950d621 | 78 | let wanted=$NR_APP*1000000 |
e72d66a6 DG |
79 | |
80 | if [ $wanted -ne $total ]; then | |
6950d621 CB |
81 | fail "Trace validation" |
82 | diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total" | |
e72d66a6 | 83 | else |
6950d621 CB |
84 | pass "Trace validation" |
85 | diag "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total" | |
e72d66a6 DG |
86 | fi |
87 | ||
88 | rm -rf $TRACE_PATH | |
89 | rm $TEMP_FILE $TEMP_FILE_2 |