From: Julien Desfossez Date: Mon, 1 Jun 2015 18:16:29 +0000 (-0400) Subject: rename to avoid eventual clash for a future lttngtrace X-Git-Tag: v0.3~6 X-Git-Url: http://git.lttng.org/?p=lttngtop.git;a=commitdiff_plain;h=1fdaa9defdae5b5ec305da1e063bd5cb09f49a22 rename to avoid eventual clash for a future lttngtrace Signed-off-by: Julien Desfossez --- diff --git a/doc/lttngtoptrace.1 b/doc/lttngtoptrace.1 new file mode 100644 index 0000000..e14218c --- /dev/null +++ b/doc/lttngtoptrace.1 @@ -0,0 +1,108 @@ +.TH "LTTNGTRACE" "1" "June 01, 2015" "" "" + +.SH "NAME" +lttngtrace \(em Live textual LTTng Trace Viewer + +.SH "SYNOPSIS" + +.PP +.nf +lttngtrace [OPTIONS] [EXECUTABLE] +.fi +.SH "DESCRIPTION" + +.PP + +Lttngtrace is a live textual LTTng trace viewer, it allows to easily (one +command) start a LTTng session and view the live events. The intent is to do +something similar to strace but less intrusive and more flexible: +.nf +- run a command and see it's kernel trace almost instantly without slowing it + down too much (buffered at most 1 second) in combination with the trace of + any other process or the whole system +- follow multiple processes and/or the whole system +- follow the children of all attached processes +- attach to processes by name and/or pid +- actual time taken by the system calls (with reminder of start timestamp) +- sched_switch events to know the context switches that occurred for the + process we are interested in +- current CPU (to see the migrations) +- highlight the trace of a selection of processes while tracing the whole + system to easily see the interactions +- arbitrary kprobe additions to see if a process hits a certain place in the + kernel +.fi + +.PP +Only a subset of the LTTng events are enabled (the statedump, sched_switch, +sched_process_fork and all the system calls). + +.PP + +The events are displayed with additionnal context information than just the raw +LTTng trace (such as the current process name/PID/TID, the start/end time of +the current system call, the delay since the last displayed event (filtering +aware)). + +.SH "OPTIONS" + +.TP +.BR "-f" +Follow threads associated with selected PIDs +.TP +.BR "-p" +Comma-separated list of PIDs to display (in addition to the eventual executed program) +.TP +.BR "-n" +Comma-separated list of procnames to display (in addition to the eventual executed program) +.TP +.BR "-a" +In textdump mode, display all events but write in bold the processes we are interested in (-f and -p) +.TP +.BR "-k" +kprobes to insert (same format as lttng enable-event, can be repeated) +.TP +.BR "-o " +In textdump, output the log in +.TP +.BR "EXECUTABLE" +Program to run and connect the tracer (can be combined with other options to see the trace of other processes) + +.SH "REQUIREMENTS" + +.PP + +A working installation of LTTng >= 2.4, the appropriate rights for the user to +create a kernel trace and start daemons (sudo is tried in case the user is not +root), Babeltrace = 1.2.4, LTTngTop = 0.3 + +.SH "SEE ALSO" + +.PP +lttngtop(1), babeltrace(1), babeltrace-log(1), lttng(1), lttng-ust(3), lttng-sessiond(8) +.PP +.SH "BUGS" + +.PP +Some highlighting problems with -a +.SH "CREDITS" + +lttngtrace is a wrapper on top of LTTngTop released under the GPLv2 license. +See the LICENSE file in the source tree for details. + +.PP +A Web site is available at http://www.efficios.com/babeltrace for more +information on Babeltrace and the Common Trace Format. See +http://lttng.org for more information on the LTTng project. +.PP +Mailing list for support and development: . +.PP +You can find us on IRC server irc.oftc.net (OFTC) in #lttng. +.PP + +.SH "AUTHORS" + +.PP +LTTngTop was originally written and is maintained by Julien Desfossez + +.PP diff --git a/doc/lttngtrace.1 b/doc/lttngtrace.1 deleted file mode 100644 index e14218c..0000000 --- a/doc/lttngtrace.1 +++ /dev/null @@ -1,108 +0,0 @@ -.TH "LTTNGTRACE" "1" "June 01, 2015" "" "" - -.SH "NAME" -lttngtrace \(em Live textual LTTng Trace Viewer - -.SH "SYNOPSIS" - -.PP -.nf -lttngtrace [OPTIONS] [EXECUTABLE] -.fi -.SH "DESCRIPTION" - -.PP - -Lttngtrace is a live textual LTTng trace viewer, it allows to easily (one -command) start a LTTng session and view the live events. The intent is to do -something similar to strace but less intrusive and more flexible: -.nf -- run a command and see it's kernel trace almost instantly without slowing it - down too much (buffered at most 1 second) in combination with the trace of - any other process or the whole system -- follow multiple processes and/or the whole system -- follow the children of all attached processes -- attach to processes by name and/or pid -- actual time taken by the system calls (with reminder of start timestamp) -- sched_switch events to know the context switches that occurred for the - process we are interested in -- current CPU (to see the migrations) -- highlight the trace of a selection of processes while tracing the whole - system to easily see the interactions -- arbitrary kprobe additions to see if a process hits a certain place in the - kernel -.fi - -.PP -Only a subset of the LTTng events are enabled (the statedump, sched_switch, -sched_process_fork and all the system calls). - -.PP - -The events are displayed with additionnal context information than just the raw -LTTng trace (such as the current process name/PID/TID, the start/end time of -the current system call, the delay since the last displayed event (filtering -aware)). - -.SH "OPTIONS" - -.TP -.BR "-f" -Follow threads associated with selected PIDs -.TP -.BR "-p" -Comma-separated list of PIDs to display (in addition to the eventual executed program) -.TP -.BR "-n" -Comma-separated list of procnames to display (in addition to the eventual executed program) -.TP -.BR "-a" -In textdump mode, display all events but write in bold the processes we are interested in (-f and -p) -.TP -.BR "-k" -kprobes to insert (same format as lttng enable-event, can be repeated) -.TP -.BR "-o " -In textdump, output the log in -.TP -.BR "EXECUTABLE" -Program to run and connect the tracer (can be combined with other options to see the trace of other processes) - -.SH "REQUIREMENTS" - -.PP - -A working installation of LTTng >= 2.4, the appropriate rights for the user to -create a kernel trace and start daemons (sudo is tried in case the user is not -root), Babeltrace = 1.2.4, LTTngTop = 0.3 - -.SH "SEE ALSO" - -.PP -lttngtop(1), babeltrace(1), babeltrace-log(1), lttng(1), lttng-ust(3), lttng-sessiond(8) -.PP -.SH "BUGS" - -.PP -Some highlighting problems with -a -.SH "CREDITS" - -lttngtrace is a wrapper on top of LTTngTop released under the GPLv2 license. -See the LICENSE file in the source tree for details. - -.PP -A Web site is available at http://www.efficios.com/babeltrace for more -information on Babeltrace and the Common Trace Format. See -http://lttng.org for more information on the LTTng project. -.PP -Mailing list for support and development: . -.PP -You can find us on IRC server irc.oftc.net (OFTC) in #lttng. -.PP - -.SH "AUTHORS" - -.PP -LTTngTop was originally written and is maintained by Julien Desfossez - -.PP diff --git a/utils/lttngtoptrace b/utils/lttngtoptrace new file mode 100755 index 0000000..5486d90 --- /dev/null +++ b/utils/lttngtoptrace @@ -0,0 +1,134 @@ +#!/bin/bash + +# Wrapper to setup a live session on localhost and read it in text mode live + +SESSION_NAME="lttngtop-live-simple-$RANDOM" + +destroy() +{ + lttng destroy $SESSION_NAME >/dev/null + rm -rf $HOME/lttng-traces/$HOSTNAME/${SESSION_NAME}* + exit 0 +} + +if test "$1" = "-h" -o "$1" = "--help"; then + echo "usage : $0 [OPTIONS] [program [program-options]]" + echo "OPTIONS :" + echo " -f Follow threads associated with selected PIDs" + echo " -p Comma-separated list of PIDs to display (in addition to the eventual executed program)" + echo " -n Comma-separated list of procnames to display (in addition to the eventual executed program)" + echo " -a In textdump mode, display all events but write in bold the processes we are interested in (-f and -p)" + echo " -k kprobes to insert (same format as lttng enable-event, can be repeated)" + echo " -o In textdump, output the log in " + exit 0 +fi + +pgrep -u root lttng-sessiond >/dev/null +if test $? != 0; then + echo "Starting lttng-sessiond as root (trying sudo, start manually if \ +it fails)" + sudo lttng-sessiond -d + if test $? != 0; then + exit 1 + fi +fi + +pgrep lttng-relayd >/dev/null +if test $? != 0; then + echo "Starting lttng-relayd as your current user, start manually if \ +it fails" + lttng-relayd -d + if test $? != 0; then + exit 1 + fi +fi + +SUDO="" +groups|grep tracing >/dev/null +if test $? != 0; then + echo "You are not a member of the tracing group, so you need root \ +access, the script will try with sudo" + SUDO="sudo" +fi + +# check if lttng command if in the path +# check if the user can execute the command (with sudo if not in tracing group) +# check if lttng-modules is installed +$SUDO lttng list -k | grep sched_switch >/dev/null +if test $? != 0; then + echo "Something went wrong executing \"$SUDO lttng list -k | grep sched_switch\", \ +try to fix the problem manually and then start the script again" +fi + +# if our random session name was already in use, add more randomness... +$SUDO lttng list | grep $SESSION_NAME +if test $? = 0; then + SESSION_NAME="$SESSION_NAME-$RANDOM" +fi +$SUDO lttng list | grep $SESSION_NAME +if test $? = 0; then + echo "Cannot create a random session name, something must be wrong" + exit 2 +fi + +lttng create $SESSION_NAME --live 1000000 -U net://localhost >/dev/null +[[ $? != 0 ]] && exit 2 + +trap "destroy" SIGINT SIGTERM + +lttng enable-event -s $SESSION_NAME -u -a >/dev/null +lttng add-context -s $SESSION_NAME -u -t vpid -t procname -t vtid >/dev/null + +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,sched_process_fork >/dev/null +[[ $? != 0 ]] && exit 2 +lttng enable-event -s $SESSION_NAME -k --syscall -a >/dev/null +[[ $? != 0 ]] && exit 2 +lttng add-context -s $SESSION_NAME -k -t pid -t procname -t tid -t ppid >/dev/null +[[ $? != 0 ]] && exit 2 +# if you want to add Perf counters, do something like that : +#lttng add-context -s $SESSION_NAME -k -t perf:cache-misses -t perf:major-faults -t perf:branch-load-misses >/dev/null + +LTTNGTOPARGS="" +PROG="" + +while [ "$1" != "" ]; do + if test "$1" = "-p"; then + shift + LTTNGTOPARGS="$LTTNGTOPARGS -p $1" + shift + elif test "$1" = "-k"; then + shift + lttng enable-event -k -s $SESSION_NAME "probe-$1" --probe $1 >/dev/null + shift + elif test "$1" = "-o"; then + shift + LTTNGTOPARGS="$LTTNGTOPARGS -o $1" + shift + elif test "$1" = "-n"; then + shift + LTTNGTOPARGS="$LTTNGTOPARGS -n $1" + shift + elif test "${1:0:1}" = "-"; then + LTTNGTOPARGS="$LTTNGTOPARGS $1" + shift + else + PROG=$@ + break + fi +done + +if test ! -z "$PROG"; then + PROG="-- $PROG" +fi + +lttng start $SESSION_NAME >/dev/null +[[ $? != 0 ]] && exit 2 + +s=$(lttngtop -r net://localhost | grep $SESSION_NAME) +if test $? != 0; then + echo "Problem executing lttngtop -r net://localhost | grep $SESSION_NAME" + exit 1 +fi +lttngtop -t -r $(echo $s|cut -d' ' -f1) $LTTNGTOPARGS $PROG + +destroy diff --git a/utils/lttngtrace b/utils/lttngtrace deleted file mode 100755 index 5486d90..0000000 --- a/utils/lttngtrace +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash - -# Wrapper to setup a live session on localhost and read it in text mode live - -SESSION_NAME="lttngtop-live-simple-$RANDOM" - -destroy() -{ - lttng destroy $SESSION_NAME >/dev/null - rm -rf $HOME/lttng-traces/$HOSTNAME/${SESSION_NAME}* - exit 0 -} - -if test "$1" = "-h" -o "$1" = "--help"; then - echo "usage : $0 [OPTIONS] [program [program-options]]" - echo "OPTIONS :" - echo " -f Follow threads associated with selected PIDs" - echo " -p Comma-separated list of PIDs to display (in addition to the eventual executed program)" - echo " -n Comma-separated list of procnames to display (in addition to the eventual executed program)" - echo " -a In textdump mode, display all events but write in bold the processes we are interested in (-f and -p)" - echo " -k kprobes to insert (same format as lttng enable-event, can be repeated)" - echo " -o In textdump, output the log in " - exit 0 -fi - -pgrep -u root lttng-sessiond >/dev/null -if test $? != 0; then - echo "Starting lttng-sessiond as root (trying sudo, start manually if \ -it fails)" - sudo lttng-sessiond -d - if test $? != 0; then - exit 1 - fi -fi - -pgrep lttng-relayd >/dev/null -if test $? != 0; then - echo "Starting lttng-relayd as your current user, start manually if \ -it fails" - lttng-relayd -d - if test $? != 0; then - exit 1 - fi -fi - -SUDO="" -groups|grep tracing >/dev/null -if test $? != 0; then - echo "You are not a member of the tracing group, so you need root \ -access, the script will try with sudo" - SUDO="sudo" -fi - -# check if lttng command if in the path -# check if the user can execute the command (with sudo if not in tracing group) -# check if lttng-modules is installed -$SUDO lttng list -k | grep sched_switch >/dev/null -if test $? != 0; then - echo "Something went wrong executing \"$SUDO lttng list -k | grep sched_switch\", \ -try to fix the problem manually and then start the script again" -fi - -# if our random session name was already in use, add more randomness... -$SUDO lttng list | grep $SESSION_NAME -if test $? = 0; then - SESSION_NAME="$SESSION_NAME-$RANDOM" -fi -$SUDO lttng list | grep $SESSION_NAME -if test $? = 0; then - echo "Cannot create a random session name, something must be wrong" - exit 2 -fi - -lttng create $SESSION_NAME --live 1000000 -U net://localhost >/dev/null -[[ $? != 0 ]] && exit 2 - -trap "destroy" SIGINT SIGTERM - -lttng enable-event -s $SESSION_NAME -u -a >/dev/null -lttng add-context -s $SESSION_NAME -u -t vpid -t procname -t vtid >/dev/null - -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,sched_process_fork >/dev/null -[[ $? != 0 ]] && exit 2 -lttng enable-event -s $SESSION_NAME -k --syscall -a >/dev/null -[[ $? != 0 ]] && exit 2 -lttng add-context -s $SESSION_NAME -k -t pid -t procname -t tid -t ppid >/dev/null -[[ $? != 0 ]] && exit 2 -# if you want to add Perf counters, do something like that : -#lttng add-context -s $SESSION_NAME -k -t perf:cache-misses -t perf:major-faults -t perf:branch-load-misses >/dev/null - -LTTNGTOPARGS="" -PROG="" - -while [ "$1" != "" ]; do - if test "$1" = "-p"; then - shift - LTTNGTOPARGS="$LTTNGTOPARGS -p $1" - shift - elif test "$1" = "-k"; then - shift - lttng enable-event -k -s $SESSION_NAME "probe-$1" --probe $1 >/dev/null - shift - elif test "$1" = "-o"; then - shift - LTTNGTOPARGS="$LTTNGTOPARGS -o $1" - shift - elif test "$1" = "-n"; then - shift - LTTNGTOPARGS="$LTTNGTOPARGS -n $1" - shift - elif test "${1:0:1}" = "-"; then - LTTNGTOPARGS="$LTTNGTOPARGS $1" - shift - else - PROG=$@ - break - fi -done - -if test ! -z "$PROG"; then - PROG="-- $PROG" -fi - -lttng start $SESSION_NAME >/dev/null -[[ $? != 0 ]] && exit 2 - -s=$(lttngtop -r net://localhost | grep $SESSION_NAME) -if test $? != 0; then - echo "Problem executing lttngtop -r net://localhost | grep $SESSION_NAME" - exit 1 -fi -lttngtop -t -r $(echo $s|cut -d' ' -f1) $LTTNGTOPARGS $PROG - -destroy