SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / doc / examples / trigger-on-event / performance / perform-experience.sh
CommitLineData
2463b787
JR
1#!/bin/bash
2#
3# Copyright (C) 2020 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4#
5# SPDX-License-Identifier: MIT
6
7EVENT_NAME_HIT=performance:hit
8EVENT_NAME_RECEIVE=performance:receive
9TRIGGER_NAME=performance_hit
10
11if [ -z "$1" ]; then
12 echo "missing source id int value"
13 exit 1
14fi
15
16if [ -z "$2" ]; then
17 echo "missing trace directory name"
18 exit 1
19fi
20
21if [ -z "$3" ]; then
22 echo "missing loop delay"
23 exit 1
24fi
25
26if [ -z "$4" ]; then
27 echo "missing loop count"
28 exit 1
29fi
30
31key_id="$1"
32trace_directory="$(pwd)/trace/$2"
33delay=$3
34count=$4
35
36if ! lttng list > /dev/null 2>&1 ; then
37 echo "Could not connect to session daemon, are you sure it is running?"
38 exit 1
39fi
40
41lttng create performance --output="$trace_directory"
42lttng enable-event -u $EVENT_NAME_HIT,$EVENT_NAME_RECEIVE -s performance
43lttng start
44
45filter="source==$key_id"
46lttng add-trigger --id ${TRIGGER_NAME} --condition on-event --userspace $EVENT_NAME_HIT --filter="$filter" --action notify
47
48./consumer "$key_id" "$count" $TRIGGER_NAME &
49
50# Cheap way to synchronize and ensure that the consumer is ready to consume
51sleep 2
52
53./producer "$key_id" "$count" "$delay" &
54
55wait
56
57lttng remove-trigger ${TRIGGER_NAME}
58
59lttng stop
60lttng destroy performance
61
This page took 0.02554 seconds and 5 git commands to generate.