3 # Setup a live LTTng session on localhost
5 SESSION_NAME
="lttngtop-live-simple"
8 pgrep
-u root lttng-sessiond
>/dev
/null
10 echo "Starting lttng-sessiond as root (trying sudo, start manually if \
12 sudo lttng-sessiond
-d
18 pgrep lttng-relayd
>/dev
/null
20 echo "Starting lttng-relayd as your current user, start manually if \
29 groups|
grep tracing
>/dev
/null
31 echo "You are not a member of the tracing group, so you need root \
32 access, the script will try with sudo"
36 # check if lttng command if in the path
37 # check if the user can execute the command (with sudo if not in tracing group)
38 # check if lttng-modules is installed
39 $SUDO lttng list
-k |
grep sched_switch
>/dev
/null
41 echo "Something went wrong executing \"$SUDO lttng list -k | grep sched_switch\", \
42 try to fix the problem manually and then start the script again"
45 lttng create
$SESSION_NAME --live 1000000 -U net
://localhost
>/dev
/null
46 [[ $?
!= 0 ]] && exit 2
47 lttng enable-event
-s $SESSION_NAME -k lttng_statedump_start
,lttng_statedump_end
,lttng_statedump_process_state
,lttng_statedump_file_descriptor
,lttng_statedump_vm_map
,lttng_statedump_network_interface
,lttng_statedump_interrupt
,sched_process_free
,sched_switch
>/dev
/null
48 [[ $?
!= 0 ]] && exit 2
49 lttng enable-event
-s $SESSION_NAME -k --syscall -a >/dev
/null
50 [[ $?
!= 0 ]] && exit 2
51 lttng add-context
-s $SESSION_NAME -k -t pid
-t procname
-t tid
-t ppid
-t perf
:cache-misses
-t perf
:major-faults
-t perf
:branch-load-misses
>/dev
/null
52 [[ $?
!= 0 ]] && exit 2
53 lttng start
$SESSION_NAME >/dev
/null
54 [[ $?
!= 0 ]] && exit 2
56 s
=$
(lttngtop
-r net
://localhost |
grep $SESSION_NAME)
58 echo "Problem executing lttngtop -r net://localhost | grep $SESSION_NAME"
62 lttngtop
-r $
(echo $s|cut
-d' ' -f1)
64 lttng destroy
$SESSION_NAME >/dev
/null
65 echo -n "Destroy $HOME/lttng-traces/$HOSTNAME/${SESSION_NAME}* (Y/n) ? "
67 if test $a = 'y' -o $a = 'Y'; then
68 rm -rf $HOME/lttng-traces
/$HOSTNAME/${SESSION_NAME}*