Commit caa14ed6 authored by Paul Chaignon's avatar Paul Chaignon Committed by Sasha Goldshtein

u* tools: per-language wrappers (#1086)

parent a4ad687d
...@@ -137,12 +137,12 @@ pair of .c and .py files, and some are directories of files. ...@@ -137,12 +137,12 @@ pair of .c and .py files, and some are directories of files.
- tools/[tplist](tools/tplist.py): Display kernel tracepoints or USDT probes and their formats. [Examples](tools/tplist_example.txt). - tools/[tplist](tools/tplist.py): Display kernel tracepoints or USDT probes and their formats. [Examples](tools/tplist_example.txt).
- tools/[trace](tools/trace.py): Trace arbitrary functions, with filters. [Examples](tools/trace_example.txt). - tools/[trace](tools/trace.py): Trace arbitrary functions, with filters. [Examples](tools/trace_example.txt).
- tools/[ttysnoop](tools/ttysnoop.py): Watch live output from a tty or pts device. [Examples](tools/ttysnoop_example.txt). - tools/[ttysnoop](tools/ttysnoop.py): Watch live output from a tty or pts device. [Examples](tools/ttysnoop_example.txt).
- tools/[ucalls](tools/ucalls.py): Summarize method calls or Linux syscalls in high-level languages. [Examples](tools/ucalls_example.txt). - tools/[ucalls](tools/lib/ucalls.py): Summarize method calls or Linux syscalls in high-level languages. [Examples](tools/lib/ucalls_example.txt).
- tools/[uflow](tools/uflow.py): Print a method flow graph in high-level languages. [Examples](tools/uflow_example.txt). - tools/[uflow](tools/lib/uflow.py): Print a method flow graph in high-level languages. [Examples](tools/lib/uflow_example.txt).
- tools/[ugc](tools/ugc.py): Trace garbage collection events in high-level languages. [Examples](tools/ugc_example.txt). - tools/[ugc](tools/lib/ugc.py): Trace garbage collection events in high-level languages. [Examples](tools/lib/ugc_example.txt).
- tools/[uobjnew](tools/uobjnew.py): Summarize object allocation events by object type and number of bytes allocated. [Examples](tools/uobjnew_example.txt). - tools/[uobjnew](tools/lib/uobjnew.py): Summarize object allocation events by object type and number of bytes allocated. [Examples](tools/lib/uobjnew_example.txt).
- tools/[ustat](tools/ustat.py): Collect events such as GCs, thread creations, object allocations, exceptions and more in high-level languages. [Examples](tools/ustat_example.txt). - tools/[ustat](tools/lib/ustat.py): Collect events such as GCs, thread creations, object allocations, exceptions and more in high-level languages. [Examples](tools/lib/ustat_example.txt).
- tools/[uthreads](tools/uthreads.py): Trace thread creation events in Java and raw pthreads. [Examples](tools/uthreads_example.txt). - tools/[uthreads](tools/lib/uthreads.py): Trace thread creation events in Java and raw pthreads. [Examples](tools/lib/uthreads_example.txt).
- tools/[vfscount](tools/vfscount.py) tools/[vfscount.c](tools/vfscount.c): Count VFS calls. [Examples](tools/vfscount_example.txt). - tools/[vfscount](tools/vfscount.py) tools/[vfscount.c](tools/vfscount.c): Count VFS calls. [Examples](tools/vfscount_example.txt).
- tools/[vfsstat](tools/vfsstat.py) tools/[vfsstat.c](tools/vfsstat.c): Count some VFS calls, with column output. [Examples](tools/vfsstat_example.txt). - tools/[vfsstat](tools/vfsstat.py) tools/[vfsstat.c](tools/vfsstat.c): Count some VFS calls, with column output. [Examples](tools/vfsstat_example.txt).
- tools/[wakeuptime](tools/wakeuptime.py): Summarize sleep to wakeup time by waker kernel stack. [Examples](tools/wakeuptime_example.txt). - tools/[wakeuptime](tools/wakeuptime.py): Summarize sleep to wakeup time by waker kernel stack. [Examples](tools/wakeuptime_example.txt).
......
uobjnew.8
\ No newline at end of file
ucalls.8
\ No newline at end of file
uflow.8
\ No newline at end of file
ugc.8
\ No newline at end of file
uobjnew.8
\ No newline at end of file
ustat.8
\ No newline at end of file
uthreads.8
\ No newline at end of file
ugc.8
\ No newline at end of file
ustat.8
\ No newline at end of file
ucalls.8
\ No newline at end of file
uflow.8
\ No newline at end of file
ustat.8
\ No newline at end of file
ucalls.8
\ No newline at end of file
uflow.8
\ No newline at end of file
ugc.8
\ No newline at end of file
ustat.8
\ No newline at end of file
ucalls.8
\ No newline at end of file
uflow.8
\ No newline at end of file
ugc.8
\ No newline at end of file
uobjnew.8
\ No newline at end of file
ustat.8
\ No newline at end of file
.TH ucalls 8 "2016-11-07" "USER COMMANDS" .TH ucalls 8 "2016-11-07" "USER COMMANDS"
.SH NAME .SH NAME
ucalls \- Summarize method calls from high-level languages and Linux syscalls. ucalls, javacalls, pythoncalls, rubycalls, phpcalls \- Summarize method calls
from high-level languages and Linux syscalls.
.SH SYNOPSIS .SH SYNOPSIS
.B javacalls [-h] [-T TOP] [-L] [-S] [-v] [-m] pid [interval]
.br
.B pythoncalls [-h] [-T TOP] [-L] [-S] [-v] [-m] pid [interval]
.br
.B rubycalls [-h] [-T TOP] [-L] [-S] [-v] [-m] pid [interval]
.br
.B phpcalls [-h] [-T TOP] [-L] [-S] [-v] [-m] pid [interval]
.br
.B ucalls [-l {java,python,ruby,php}] [-h] [-T TOP] [-L] [-S] [-v] [-m] pid [interval] .B ucalls [-l {java,python,ruby,php}] [-h] [-T TOP] [-L] [-S] [-v] [-m] pid [interval]
.SH DESCRIPTION .SH DESCRIPTION
This tool summarizes method calls from high-level languages such as Python, This tool summarizes method calls from high-level languages such as Python,
......
.TH uflow 8 "2016-11-07" "USER COMMANDS" .TH uflow 8 "2016-11-07" "USER COMMANDS"
.SH NAME .SH NAME
uflow \- Print a flow graph of method calls in high-level languages. uflow, javaflow, pythonflow, rubyflow, phpflow \- Print a flow graph of method
calls in high-level languages.
.SH SYNOPSIS .SH SYNOPSIS
.B uflow [-h] [-M METHOD] [-C CLAZZ] [-v] {java,python,ruby,php} pid .B javaflow [-h] [-M METHOD] [-C CLAZZ] [-v] pid
.br
.B pythonflow [-h] [-M METHOD] [-C CLAZZ] [-v] pid
.br
.B rubyflow [-h] [-M METHOD] [-C CLAZZ] [-v] pid
.br
.B phpflow [-h] [-M METHOD] [-C CLAZZ] [-v] pid
.br
.B uflow [-h] [-M METHOD] [-C CLAZZ] [-v] [-l {java,python,ruby,php}] pid
.SH DESCRIPTION .SH DESCRIPTION
uflow traces method calls and prints them in a flow graph that can facilitate uflow traces method calls and prints them in a flow graph that can facilitate
debugging and diagnostics by following the program's execution (method flow). debugging and diagnostics by following the program's execution (method flow).
......
.TH ugc 8 "2016-11-07" "USER COMMANDS" .TH ugc 8 "2016-11-07" "USER COMMANDS"
.SH NAME .SH NAME
ugc \- Trace garbage collection events in high-level languages. ugc, javagc, pythongc, rubygc, nodegc \- Trace garbage collection events in
high-level languages.
.SH SYNOPSIS .SH SYNOPSIS
.B ugc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] {java,python,ruby,node} pid .B javagc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
.br
.B pythongc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
.br
.B rubygc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
.br
.B nodegc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
.br
.B ugc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] [-l {java,python,ruby,node}] pid
.SH DESCRIPTION .SH DESCRIPTION
This traces garbage collection events as they occur, including their duration This traces garbage collection events as they occur, including their duration
and any additional information (such as generation collected or type of GC) and any additional information (such as generation collected or type of GC)
......
.TH uobjnew 8 "2016-11-07" "USER COMMANDS" .TH uobjnew 8 "2016-11-07" "USER COMMANDS"
.SH NAME .SH NAME
uobjnew \- Summarize object allocations in high-level languages. uobjnew, javaobjnew, rubyobjnew, cobjnew \- Summarize object allocations in
high-level languages.
.SH SYNOPSIS .SH SYNOPSIS
.B uobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] {java,ruby,c} pid [interval] .B javaobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
.br
.B rubyobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
.br
.B cobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
.br
.B uobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] [-l {java,ruby,c}] pid [interval]
.SH DESCRIPTION .SH DESCRIPTION
uobjnew traces object allocations in high-level languages (including "malloc") uobjnew traces object allocations in high-level languages (including "malloc")
and prints summaries of the most frequently allocated types by number of and prints summaries of the most frequently allocated types by number of
......
.TH ustat 8 "2016-11-07" "USER COMMANDS" .TH ustat 8 "2016-11-07" "USER COMMANDS"
.SH NAME .SH NAME
ustat \- Activity stats from high-level languages. ustat, javastat, pythonstat, rubystat, nodestat, phpstat \- Activity stats from
high-level languages.
.SH SYNOPSIS .SH SYNOPSIS
.B javastat [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]]
.br
.B pythonstat [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]]
.br
.B rubystat [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]]
.br
.B nodestat [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]]
.br
.B phpstat [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]]
.br
.B ustat [-l {java,python,ruby,node,php}] [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]] .B ustat [-l {java,python,ruby,node,php}] [-C] [-S {cload,excp,gc,method,objnew,thread}] [-r MAXROWS] [-d] [interval [count]]
.SH DESCRIPTION .SH DESCRIPTION
This is "top" for high-level language events, such as garbage collections, This is "top" for high-level language events, such as garbage collections,
......
.TH uthreads 8 "2016-11-07" "USER COMMANDS" .TH uthreads 8 "2016-11-07" "USER COMMANDS"
.SH NAME .SH NAME
uthreads \- Trace thread creation events in Java or pthreads. uthreads, javathreads \- Trace thread creation events in Java or pthreads.
.SH SYNOPSIS .SH SYNOPSIS
.B javathreads [-h] [-v] pid
.BR
.B uthreads [-h] [-l {java}] [-v] pid .B uthreads [-h] [-l {java}] [-v] pid
.SH DESCRIPTION .SH DESCRIPTION
This traces thread creation events in Java processes, or pthread creation This traces thread creation events in Java processes, or pthread creation
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
name: bcc name: bcc
version: 0.3.0-20170322-1719-aaab74e version: 0.3.0-20170401-1747-c5f48c9
summary: BPF Compiler Collection (BCC) summary: BPF Compiler Collection (BCC)
description: A toolkit for creating efficient kernel tracing and manipulation programs description: A toolkit for creating efficient kernel tracing and manipulation programs
confinement: strict confinement: strict
...@@ -149,17 +149,59 @@ apps: ...@@ -149,17 +149,59 @@ apps:
ttysnoop: ttysnoop:
command: wrapper ttysnoop command: wrapper ttysnoop
ucalls: ucalls:
command: wrapper ucalls command: wrapper lib/ucalls
uflow: uflow:
command: wrapper uflow command: wrapper lib/uflow
ugc: ugc:
command: wrapper ugc command: wrapper lib/ugc
uobjnew: uobjnew:
command: wrapper uobjnew command: wrapper lib/uobjnew
ustat: ustat:
command: wrapper ustat command: wrapper lib/ustat
uthreads: uthreads:
command: wrapper uthreads command: wrapper lib/uthreads
cobjnew:
command: wrapper cobjnew
javacalls:
command: wrapper javacalls
javaflow:
command: wrapper javaflow
javagc:
command: wrapper javagc
javaobjnew:
command: wrapper javaobjnew
javastat:
command: wrapper javastat
javathreads:
command: wrapper javathreads
nodegc:
command: wrapper nodegc
nodestat:
command: wrapper nodestat
phpcalls:
command: wrapper phpcalls
phpflow:
command: wrapper phpflow
phpstat:
command: wrapper phpstat
pythoncalls:
command: wrapper pythoncalls
pythonflow:
command: wrapper pythonflow
pythongc:
command: wrapper pythongc
pythonstat:
command: wrapper pythonstat
rubycalls:
command: wrapper rubycalls
rubyflow:
command: wrapper rubyflow
rubygc:
command: wrapper rubygc
rubyobjnew:
command: wrapper rubyobjnew
rubystat:
command: wrapper rubystat
vfscount: vfscount:
command: wrapper vfscount command: wrapper vfscount
vfsstat: vfsstat:
......
...@@ -307,14 +307,14 @@ class SmokeTests(TestCase): ...@@ -307,14 +307,14 @@ class SmokeTests(TestCase):
def test_ucalls(self): def test_ucalls(self):
# This attaches a large number (300+) kprobes, which can be slow, # This attaches a large number (300+) kprobes, which can be slow,
# so use an increased timeout value. # so use an increased timeout value.
self.run_with_int("ucalls.py -l none -S %d" % os.getpid(), self.run_with_int("lib/ucalls.py -l none -S %d" % os.getpid(),
timeout=30, kill_timeout=30) timeout=30, kill_timeout=30)
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4") @skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
def test_uflow(self): def test_uflow(self):
# The Python installed on the Ubuntu buildbot doesn't have USDT # The Python installed on the Ubuntu buildbot doesn't have USDT
# probes, so we can't run uflow. # probes, so we can't run uflow.
# self.run_with_int("uflow.py -l python %d" % os.getpid()) # self.run_with_int("pythonflow.py %d" % os.getpid())
pass pass
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4") @skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
...@@ -325,15 +325,15 @@ class SmokeTests(TestCase): ...@@ -325,15 +325,15 @@ class SmokeTests(TestCase):
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4") @skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
def test_uobjnew(self): def test_uobjnew(self):
self.run_with_int("uobjnew.py -l c %d" % os.getpid()) self.run_with_int("cobjnew.sh %d" % os.getpid())
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4") @skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
def test_ustat(self): def test_ustat(self):
self.run_with_duration("ustat.py 1 1") self.run_with_duration("lib/ustat.py 1 1")
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4") @skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
def test_uthreads(self): def test_uthreads(self):
self.run_with_int("uthreads.py %d" % os.getpid()) self.run_with_int("lib/uthreads.py %d" % os.getpid())
def test_vfscount(self): def test_vfscount(self):
self.run_with_int("vfscount.py") self.run_with_int("vfscount.py")
......
file(GLOB C_FILES *.c) file(GLOB C_FILES *.c)
file(GLOB PY_FILES *.py) file(GLOB PY_FILES *.py)
file(GLOB SH_FILES *.sh)
file(GLOB TXT_FILES *.txt) file(GLOB TXT_FILES *.txt)
list(REMOVE_ITEM TXT_FILES "CMakeLists.txt") list(REMOVE_ITEM TXT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
foreach(FIL ${PY_FILES}) foreach(FIL ${PY_FILES})
get_filename_component(FIL_WE ${FIL} NAME_WE) get_filename_component(FIL_WE ${FIL} NAME_WE)
install(PROGRAMS ${FIL} DESTINATION share/bcc/tools RENAME ${FIL_WE}) install(PROGRAMS ${FIL} DESTINATION share/bcc/tools RENAME ${FIL_WE})
endforeach() endforeach()
foreach(FIL ${SH_FILES})
if(${FIL} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/reset-trace.sh)
get_filename_component(FIL_WE ${FIL} NAME_WE)
install(PROGRAMS ${FIL} DESTINATION share/bcc/tools RENAME ${FIL_WE})
else()
file(READ ${FIL} CONTENT)
string(REPLACE ".py -l" " -l" CONTENT_WE ${CONTENT})
string(REPLACE "\"" "\\\"" CONTENT_WE ${CONTENT_WE})
get_filename_component(FIL_WE ${FIL} NAME_WE)
install(PROGRAMS ${FIL} DESTINATION share/bcc/tools RENAME ${FIL_WE})
install(CODE "file(WRITE \"\$ENV{DESTDIR}/\${CMAKE_INSTALL_PREFIX}/share/bcc/tools/${FIL_WE}\" \"${CONTENT_WE}\")")
endif()
endforeach()
install(FILES ${C_FILES} DESTINATION share/bcc/tools) install(FILES ${C_FILES} DESTINATION share/bcc/tools)
install(FILES ${TXT_FILES} DESTINATION share/bcc/tools/doc) install(FILES ${TXT_FILES} DESTINATION share/bcc/tools/doc)
add_subdirectory(lib)
add_subdirectory(old) add_subdirectory(old)
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uobjnew.py -l c "$@"
lib/uobjnew_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ucalls.py -l java "$@"
lib/ucalls_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uflow.py -l java "$@"
lib/uflow_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ugc.py -l java "$@"
lib/ugc_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uobjnew.py -l java "$@"
lib/uobjnew_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ustat.py -l java "$@"
lib/ustat_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uthreads.py -l java "$@"
lib/uthreads_example.txt
\ No newline at end of file
file(GLOB PY_FILES *.py)
file(GLOB TXT_FILES *.txt)
list(REMOVE_ITEM TXT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
foreach(FIL ${PY_FILES})
get_filename_component(FIL_WE ${FIL} NAME_WE)
install(PROGRAMS ${FIL} DESTINATION share/bcc/tools/lib RENAME ${FIL_WE})
endforeach()
install(FILES ${TXT_FILES} DESTINATION share/bcc/tools/doc/lib)
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ugc.py -l node "$@"
lib/ugc_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ustat.py -l node "$@"
lib/ustat_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ucalls.py -l php "$@"
lib/ucalls_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uflow.py -l php "$@"
lib/uflow_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ustat.py -l php "$@"
lib/ustat_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ucalls.py -l python "$@"
lib/ucalls_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uflow.py -l python "$@"
lib/uflow_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ugc.py -l python "$@"
lib/ugc_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ustat.py -l python "$@"
lib/ustat_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ucalls.py -l ruby "$@"
lib/ucalls_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uflow.py -l ruby "$@"
lib/uflow_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ugc.py -l ruby "$@"
lib/ugc_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/uobjnew.py -l ruby "$@"
lib/uobjnew_example.txt
\ No newline at end of file
#!/bin/bash
lib=$(dirname $0)/lib
$lib/ustat.py -l ruby "$@"
lib/ustat_example.txt
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment