platform/upstream/bcc.git
8 years agoFix bpf_common.cc include style (#715)
Teng Qin [Fri, 30 Sep 2016 20:13:13 +0000 (13:13 -0700)]
Fix bpf_common.cc include style (#715)

8 years agoMove libbpf.h to src/cc (#714)
Teng Qin [Fri, 30 Sep 2016 19:52:45 +0000 (12:52 -0700)]
Move libbpf.h to src/cc (#714)

8 years agoAdd stack trace to trace.py (#712)
Teng Qin [Fri, 30 Sep 2016 04:30:13 +0000 (21:30 -0700)]
Add stack trace to trace.py (#712)

8 years agoFix trace.py USDT argument filtering (#710)
Teng Qin [Wed, 28 Sep 2016 15:19:40 +0000 (08:19 -0700)]
Fix trace.py USDT argument filtering (#710)

8 years agocmake: fix build when LLVM_INCLUDE_DIRS includes multiple directories (#709)
Marco Leogrande [Wed, 28 Sep 2016 02:17:02 +0000 (19:17 -0700)]
cmake: fix build when LLVM_INCLUDE_DIRS includes multiple directories (#709)

If LLVM_INCLUDE_DIRS includes multiple directories, separated by
semicolon, the string would be incorrectly propagated all the way down
to the shell, that would interpret such semicolon as a command
separator. E.g. we would have:

 c++ ... -isystem /w/llvm/include;/w/llvm/bld/include ...

Instead, we need to parse the string as a CMake list (that are defined
as strings composed by semicolon-separated tokens) and build a string
in the form:

 c++ ... -isystem /w/llvm/include -isystem /w/llvm/bld/include ...

This bug was introduced in d19e0cb.
This commit fixes #707.

Signed-off-by: Marco Leogrande <marcol@plumgrid.com>
8 years agoFix or hide a few warnings (#695)
Marco Leogrande [Tue, 27 Sep 2016 16:41:32 +0000 (09:41 -0700)]
Fix or hide a few warnings (#695)

* Flag ${LLVM_INCLUDE_DIRS} as a system include directory

g++ supports a -isystem switch, that can be used to mark a given
directory as a system include directory. Warnings generated by system
include directories are ignored by default.

This commit hides a long list of warnings, like the following one,
generated by llvm header files included from ${LLVM_INCLUDE_DIRS}:

 /usr/lib/llvm-3.7/include/clang/AST/APValue.h:373:44: warning:
   dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Marco Leogrande <marcol@plumgrid.com>
* Fix 'defined but not used' warning

Remove unused function from the USDT probes test.

The warning was:

 tests/cc/test_usdt_probes.cc:59:15: warning:
   ‘size_t countsubs(const string&, const string&)’ defined but not used [-Wunused-function]

Signed-off-by: Marco Leogrande <marcol@plumgrid.com>
8 years agoFix argdist, trace, tplist to use the libbcc USDT support (#698)
Sasha Goldshtein [Tue, 27 Sep 2016 16:40:00 +0000 (19:40 +0300)]
Fix argdist, trace, tplist to use the libbcc USDT support (#698)

* Allow argdist to enable USDT probes without a pid

The current code would only pass the pid to the USDT
class, thereby not allowing USDT probes to be enabled
from the binary path only. If the probe doesn't have
a semaphore, it can actually be enabled for all
processes in a uniform fashion -- which is now
supported.

* Reintroduce USDT support into tplist

To print USDT probe information, tplist needs an API
to return the probe data, including the number of
arguments and locations for each probe. This commit
introduces this API, called bcc_usdt_foreach, and
invokes it from the revised tplist implementation.

Although the result is not 100% identical to the
original tplist, which could also print the probe
argument information, this is not strictly required
for users of the argdist and trace tools, which is
why it was omitted for now.

* Fix trace.py tracepoint support

Somehow, the import of the Perf class was omitted
from tracepoint.py, which would cause failures when
trace enables kernel tracepoints.

* trace: Native bcc USDT support

trace now works again by using the new bcc USDT support
instead of the home-grown Python USDT parser. This
required an additional change in the BPF Python API
to allow multiple USDT context objects to be passed to
the constructor in order to support multiple USDT
probes in a single invocation of trace. Otherwise, the
USDT-related code in trace was greatly simplified, and
uses the `bpf_usdt_readarg` macros to obtain probe
argument values.

One minor inconvenience that was introduced in the bcc
USDT API is that USDT probes with multiple locations
that reside in a shared object *must* have a pid
specified to enable, even if they don't have an
associated semaphore. The reason is that the bcc USDT
code figures out which location invoked the probe by
inspecting `ctx->ip`, which, for shared objects, can
only be determined when the specific process context is
available to figure out where the shared object was
loaded. This limitation did not previously exist,
because instead of looking at `ctx->ip`, the Python
USDT reader generated separate code for each probe
location with an incrementing identifier. It's not a
very big deal because it only means that some probes
can't be enabled without specifying a process id, which
is almost always desired anyway for USDT probes.

argdist has not yet been retrofitted with support for
multiple USDT probes, and needs to be updated in a
separate commit.

* argdist: Support multiple USDT probes

argdist now supports multiple USDT probes, as it did
before the transition to the native bcc USDT support.
This requires aggregating the USDT objects from each
probe and passing them together to the BPF constructor
when the probes are initialized and attached.

Also add a more descriptive exception message to the
USDT class when it fails to enable a probe.

8 years agofilelife: use d_name.name and d_name.len instead of d_iname (#700)
Marco Leogrande [Mon, 26 Sep 2016 22:59:51 +0000 (15:59 -0700)]
filelife: use d_name.name and d_name.len instead of d_iname (#700)

This is similar in spirit to what was done in PR #677 to fix the
problem reported in #609.

filelife.py is now converted to use the right struct field.

Signed-off-by: Marco Leogrande <marcol@plumgrid.com>
8 years ago[offcputime] allow for the speficication of a threshold for collection (#697)
Glauber Costa [Mon, 26 Sep 2016 19:59:32 +0000 (12:59 -0700)]
[offcputime] allow for the speficication of a threshold for collection (#697)

There are situations, specially when using non-folded mode, where we are
interested only in very high latencies that happen due to blocking.

While we can certainly filter out the very small ones out of the output, it is a
lot more convenient to do this from the tool itself, as it would be difficult
from an external filter to do this in one pass.

But if we are to discard unused measurements, we can do even better: we can
change the bpf code itself not to grab those traces, and gain a bit of
efficiency in scenarios in which we are only concerned about peak latencies.

This scheme can be easily extended to also allow a maximum cap in the latencies
we are interested in.

After this patch is applied, the options -m and -M can be used to set those
limits respectively.

Fixes: #588

8 years agodo no install CMakeLists.txt in tools/doc (#683)
Jörg Thalheim [Mon, 26 Sep 2016 17:37:11 +0000 (19:37 +0200)]
do no install CMakeLists.txt in tools/doc (#683)

8 years agochange the file name, bitehist.* to vfsreadlat.* (#702)
Taekho Nam [Mon, 26 Sep 2016 17:34:16 +0000 (02:34 +0900)]
change the file name, bitehist.* to vfsreadlat.* (#702)

8 years agoMerge pull request #689 from chantra/tcpconnect_port
Brendan Gregg [Fri, 16 Sep 2016 18:35:09 +0000 (11:35 -0700)]
Merge pull request #689 from chantra/tcpconnect_port

[tcpconnect] filter traced connection based on destination ports

8 years ago[tcpconnect] filter traced connection based on destination ports
chantra [Sat, 10 Sep 2016 16:44:50 +0000 (09:44 -0700)]
[tcpconnect] filter traced connection based on destination ports

Test:
While running:
while [ 1 ]; do nc -w 1 100.127.0.1 80; nc -w 1 100.127.0.1 81; done

root@vagrant:/mnt/bcc# ./tools/tcpconnect.py
PID    COMM         IP SADDR            DADDR            DPORT
19978  nc           4  10.0.2.15        100.127.0.1      80
19979  nc           4  10.0.2.15        100.127.0.1      81
19980  nc           4  10.0.2.15        100.127.0.1      80
19981  nc           4  10.0.2.15        100.127.0.1      81
root@vagrant:/mnt/bcc# ./tools/tcpconnect.py  -P 80
PID    COMM         IP SADDR            DADDR            DPORT
19987  nc           4  10.0.2.15        100.127.0.1      80
19989  nc           4  10.0.2.15        100.127.0.1      80
19991  nc           4  10.0.2.15        100.127.0.1      80
19993  nc           4  10.0.2.15        100.127.0.1      80
19995  nc           4  10.0.2.15        100.127.0.1      80
root@vagrant:/mnt/bcc# ./tools/tcpconnect.py  -P 80,81
PID    COMM         IP SADDR            DADDR            DPORT
8725   nc           4  10.0.2.15        100.127.0.1      80
8726   nc           4  10.0.2.15        100.127.0.1      81
8727   nc           4  10.0.2.15        100.127.0.1      80
8728   nc           4  10.0.2.15        100.127.0.1      81
8729   nc           4  10.0.2.15        100.127.0.1      80

Fixes #681

8 years agonew tool: capable (#690)
Brendan Gregg [Wed, 14 Sep 2016 15:15:09 +0000 (08:15 -0700)]
new tool: capable (#690)

* add new tool: capable

* refactor a little, remove extra bpf_get_current_pid_tgid()

8 years agoFix bpf log buffer for large bpf program: (#680)
davidefdl [Mon, 12 Sep 2016 19:00:37 +0000 (12:00 -0700)]
Fix bpf log buffer for large bpf program: (#680)

Use tempfile module to create a temp file

Fix some review input

Fix style check

Style

Style check

Remove builtin module from python test to run fedora ctest

Let the program calling bpf_prog_load to handle the log buffer

Check max instruction before the syscall. Fix other review comment

8 years agoMerge pull request #688 from KarimAllah/opensnoop-re
Brendan Gregg [Sun, 11 Sep 2016 04:37:53 +0000 (21:37 -0700)]
Merge pull request #688 from KarimAllah/opensnoop-re

minor cleanup + process partial name matching

8 years agoopensnoop: Introduce process name filtering
KarimAllah Ahmed [Sat, 10 Sep 2016 10:01:07 +0000 (12:01 +0200)]
opensnoop: Introduce process name filtering

Signed-off-by: KarimAllah Ahmed <karim.allah.ahmed@gmail.com>
8 years agoopensnoop: Refactor initial timestamp calculation
KarimAllah Ahmed [Sat, 10 Sep 2016 10:00:32 +0000 (12:00 +0200)]
opensnoop: Refactor initial timestamp calculation

Signed-off-by: KarimAllah Ahmed <karim.allah.ahmed@gmail.com>
8 years agoopensnoop: Remove 'delta' and 'cont' variables
KarimAllah Ahmed [Sat, 10 Sep 2016 09:53:46 +0000 (11:53 +0200)]
opensnoop: Remove 'delta' and 'cont' variables

... since they are unused.

Signed-off-by: KarimAllah Ahmed <karim.allah.ahmed@gmail.com>
8 years agoMerge pull request #686 from iovisor/tag_v0.2.0 v0.2.0
Brenden Blanco [Fri, 9 Sep 2016 00:58:25 +0000 (20:58 -0400)]
Merge pull request #686 from iovisor/tag_v0.2.0

Prepare debian changelog for v0.2.0 tag

8 years agoPrepare debian changelog for v0.2.0 tag
Brenden Blanco [Fri, 9 Sep 2016 00:15:55 +0000 (17:15 -0700)]
Prepare debian changelog for v0.2.0 tag

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMerge pull request #685 from kinvolk/iaguis/fix-indentation
Brendan Gregg [Thu, 8 Sep 2016 23:03:43 +0000 (16:03 -0700)]
Merge pull request #685 from kinvolk/iaguis/fix-indentation

examples: fix indentation in tracing/tcpv4connect

8 years agoexamples: fix indentation in tracing/tcpv4connect
Iago López Galeiras [Thu, 8 Sep 2016 14:45:11 +0000 (16:45 +0200)]
examples: fix indentation in tracing/tcpv4connect

Python doesn't like mixing spaces and tabs.

8 years agoMerge pull request #677 from markdrayton/fileslower
Brendan Gregg [Tue, 30 Aug 2016 19:18:57 +0000 (12:18 -0700)]
Merge pull request #677 from markdrayton/fileslower

fileslower: use de->d_name.name, add filtering

8 years agofileslower/filetop: use de->d_name.name, add filtering
Mark Drayton [Thu, 25 Aug 2016 19:46:35 +0000 (20:46 +0100)]
fileslower/filetop: use de->d_name.name, add filtering

8 years agoMerge pull request #675 from brendangregg/master
Brenden Blanco [Thu, 25 Aug 2016 04:01:02 +0000 (00:01 -0400)]
Merge pull request #675 from brendangregg/master

fix biosnoop after kernel change

8 years agofix biosnoop after kernel change
Brendan Gregg [Wed, 24 Aug 2016 22:10:05 +0000 (15:10 -0700)]
fix biosnoop after kernel change

8 years agoMerge pull request #674 from markdrayton/offcputime
Brendan Gregg [Wed, 24 Aug 2016 21:56:09 +0000 (14:56 -0700)]
Merge pull request #674 from markdrayton/offcputime

offcputime improvements: use less RAM, add PID/TID support

8 years agooffcputime: one symbol cache per process, improve pid/tid handling
Mark Drayton [Sun, 31 Jul 2016 21:47:07 +0000 (22:47 +0100)]
offcputime: one symbol cache per process, improve pid/tid handling

8 years agoMerge pull request #670 from iamkafai/perf_submit_skb
Brenden Blanco [Wed, 24 Aug 2016 04:21:53 +0000 (00:21 -0400)]
Merge pull request #670 from iamkafai/perf_submit_skb

Add perf_submit_skb

8 years agoAdd perf_submit_skb
Martin KaFai Lau [Fri, 19 Aug 2016 22:34:18 +0000 (15:34 -0700)]
Add perf_submit_skb

For BPF_PROG_TYPE_SCHED_CLS/ACT, the upstream kernel has recently added a
feature to efficiently output skb + meta data:
commit 555c8a8623a3 ("bpf: avoid stack copy and use skb ctx for event output")

This patch adds perf_submit_skb to BPF_PERF_OUTPUT macro.  It takes
an extra u32 argument.  perf_submit_skb will then be expanded to
bpf_perf_event_output properly to consider the newly added
u32 argument as the skb's len.

Other than the above described changes, perf_submit_skb is almost
a carbon copy of the perf_submit except the removal of the 'string name'
variable since I cannot find a specific use of it.

Note that the 3rd param type of bpf_perf_event_output has also been
changed from u32 to u64.

Added a sample program tc_perf_event.py.  Here is how the output
looks like:
[root@arch-fb-vm1 networking]# ./tc_perf_event.py
Try: "ping -6 ff02::1%me"

CPU SRC IP                           DST IP       Magic
0   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
0   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
0   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
1   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
1   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
1   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c

8 years agoMerge pull request #671 from pchaigno/fix-doc
Brendan Gregg [Sun, 21 Aug 2016 03:20:12 +0000 (20:20 -0700)]
Merge pull request #671 from pchaigno/fix-doc

Minor adjustments to the documentation

8 years agoMention that tracepoint support requires Linux 4.7
Paul Chaignon [Sat, 20 Aug 2016 12:24:03 +0000 (14:24 +0200)]
Mention that tracepoint support requires Linux 4.7

8 years agoAdjustments to the documentation
Paul Chaignon [Sat, 20 Aug 2016 12:15:07 +0000 (14:15 +0200)]
Adjustments to the documentation

Fix a few typos
Add missing link
Reword update() description sentence

8 years agoMerge pull request #668 from iovisor/ast_dev
Brenden Blanco [Fri, 19 Aug 2016 20:02:53 +0000 (13:02 -0700)]
Merge pull request #668 from iovisor/ast_dev

fix build with 4.0 llvm trunk

8 years agofix build with 4.0 llvm trunk
Alexei Starovoitov [Fri, 19 Aug 2016 02:52:57 +0000 (22:52 -0400)]
fix build with 4.0 llvm trunk

Signed-off-by: Alexei Starovoitov <ast@fb.com>
8 years agofrontends/clang: Safety check for invalid opLoc in ProbeVisitor (#667)
Brenden Blanco [Thu, 18 Aug 2016 21:33:29 +0000 (14:33 -0700)]
frontends/clang: Safety check for invalid opLoc in ProbeVisitor (#667)

As reported in #664:
In cases where the AST contains a MemberExpr with an invalid opLoc,
rewrite will fail but prior to this change would segfault. Fail a little
more gracefully, even though the program will still be rejected.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMerge pull request #663 from adrianlzt/sniff_ssl_tool
Brendan Gregg [Thu, 18 Aug 2016 20:22:35 +0000 (13:22 -0700)]
Merge pull request #663 from adrianlzt/sniff_ssl_tool

Tool to sniff data contents before encrypted with OpenSSL

8 years agoAdd capture for GnuTLS and argparse options
Adrian Lopez [Wed, 17 Aug 2016 12:08:08 +0000 (14:08 +0200)]
Add capture for GnuTLS and argparse options

Now it also captures gnutls_record_send and gnutls_record_recv calls.
Added options to filter by pid or command name, or just one lib.

8 years agoTool to sniff data contents before encrypted with OpenSSL
Adrian Lopez [Tue, 16 Aug 2016 15:49:49 +0000 (17:49 +0200)]
Tool to sniff data contents before encrypted with OpenSSL

Add tool as talked in iovisor-dev 'BCC: bpf_probe_read read function arguments'

8 years agoTypo writting BPF (#659)
Adrián López [Mon, 15 Aug 2016 18:58:40 +0000 (20:58 +0200)]
Typo writting BPF (#659)

8 years agoRevert "debian packaging: Build with -DBCC_KERNEL_HAS_SOURCE_DIR=1" (#662)
Brenden Blanco [Mon, 15 Aug 2016 18:58:16 +0000 (11:58 -0700)]
Revert "debian packaging: Build with -DBCC_KERNEL_HAS_SOURCE_DIR=1" (#662)

This reverts commit c6688dda4e856be43b8651afe92d7e32e63faea9.

8 years agoMerge pull request #661 from oujunli/ojl_dev
Brendan Gregg [Sun, 14 Aug 2016 06:57:01 +0000 (23:57 -0700)]
Merge pull request #661 from oujunli/ojl_dev

killsnoop: use current time replace timestamp and default output

8 years agokillsnoop: use current time replace timestamp and default output
Junli Ou [Sat, 13 Aug 2016 09:12:45 +0000 (17:12 +0800)]
killsnoop: use current time replace timestamp and default output

8 years agoupdate debian packaging (#657)
Brenden Blanco [Thu, 11 Aug 2016 21:02:40 +0000 (14:02 -0700)]
update debian packaging (#657)

* debian packaging: Add missing Build-dependencies

* Add clang-format-3.7 to build-depends

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
* debian packaging: Build with -DBCC_KERNEL_HAS_SOURCE_DIR=1

This is required to use the distro-provided includes on Debian/Ubuntu

8 years agoMerge pull request #655 from markdrayton/dcsnoop
Brendan Gregg [Thu, 11 Aug 2016 17:10:55 +0000 (10:10 -0700)]
Merge pull request #655 from markdrayton/dcsnoop

dcsnoop: use PERF_EVENT_OUTPUT

8 years agoMerge branch 'master' into dcsnoop
Mark Drayton [Thu, 11 Aug 2016 09:39:03 +0000 (10:39 +0100)]
Merge branch 'master' into dcsnoop

8 years agodcsnoop: use PERF_EVENT_OUTPUT
Mark Drayton [Wed, 13 Jul 2016 17:15:05 +0000 (18:15 +0100)]
dcsnoop: use PERF_EVENT_OUTPUT

8 years agoMerge pull request #654 from palmtenor/docs
Brendan Gregg [Thu, 11 Aug 2016 01:04:32 +0000 (18:04 -0700)]
Merge pull request #654 from palmtenor/docs

Add some explanation for functions in BPF program in Tutorial

8 years agoImprove tutorial
Teng Qin [Thu, 11 Aug 2016 00:35:28 +0000 (17:35 -0700)]
Improve tutorial

8 years agoMotivate delete() before update() in tutorial (#651)
Paul Chaignon [Tue, 9 Aug 2016 16:38:05 +0000 (18:38 +0200)]
Motivate delete() before update() in tutorial (#651)

This delete() is required because of a kernel bug:
https://git.kernel.org/cgit/linux/kernel/git/davem/net.git/commit/?id=a6ed3ea65d9868fdf9eff84e6fe4f666b8d14b02

8 years agoAdd bpf_get_current_task() helper definition (#650)
Omar Sandoval [Sat, 6 Aug 2016 03:43:35 +0000 (20:43 -0700)]
Add bpf_get_current_task() helper definition (#650)

Signed-off-by: Omar Sandoval <osandov@fb.com>
8 years agofunccount: filter bcc function count (#645)
Junli Ou [Sat, 6 Aug 2016 03:43:20 +0000 (11:43 +0800)]
funccount: filter bcc function count (#645)

8 years agoMerge pull request #649 from iovisor/ast_dev
Brenden Blanco [Fri, 5 Aug 2016 04:44:14 +0000 (21:44 -0700)]
Merge pull request #649 from iovisor/ast_dev

fix build with llvm 4.0

8 years agofix build with llvm 4.0
Alexei Starovoitov [Fri, 5 Aug 2016 04:01:11 +0000 (00:01 -0400)]
fix build with llvm 4.0

Signed-off-by: Alexei Starovoitov <ast@fb.com>
8 years agoAdd bcc_syms.h to C++ install (#648)
Teng Qin [Fri, 5 Aug 2016 03:14:13 +0000 (20:14 -0700)]
Add bcc_syms.h to C++ install (#648)

8 years agoDisable static-libstdc++ when clang is linked dynamically (#647)
Brenden Blanco [Fri, 5 Aug 2016 03:13:19 +0000 (20:13 -0700)]
Disable static-libstdc++ when clang is linked dynamically (#647)

Based on the bug report in
https://bugs.gentoo.org/show_bug.cgi?id=582770, mixing static+non-static
libstdc++ can lead to crashes. Disable such combinations. Choosing to
leave out the llvm check, since in practice clang is less likely to be
provided statically, so the check should cover both cases.

Fixes: #633
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agostyle nits (#646)
Brendan Gregg [Wed, 3 Aug 2016 22:15:41 +0000 (15:15 -0700)]
style nits (#646)

8 years agoMerge pull request #644 from iovisor/dns-update
Brenden Blanco [Tue, 2 Aug 2016 21:44:20 +0000 (14:44 -0700)]
Merge pull request #644 from iovisor/dns-update

Update readme with dns name and https for repo server

8 years agoUpdate readme with dns name and https for repo server
Brenden Blanco [Tue, 2 Aug 2016 02:22:03 +0000 (19:22 -0700)]
Update readme with dns name and https for repo server

We enabled dns for the repo and builtbot, and then turned on letsencrypt
for those as well. Yay, now we look slightly more official.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoadd open_perf_event api for reading perf counters (#643)
Brenden Blanco [Tue, 2 Aug 2016 01:12:11 +0000 (18:12 -0700)]
add open_perf_event api for reading perf counters (#643)

* add open_perf_event api for reading perf counters

Though the rewriter table method existed, we were not yet opening up the
perf counter in the proper way for it to be read.

Introduce a c function to enable attaching perf counters to cpu-indexed
table slots. The python side opens, assigns, then immediately closes the
fd. Only the kernel keeps a reference, so closing the table or deleting
the entry will be sufficient to free up the fd when finished.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
* Skip perf array hw counter test if unsupported

Hardware counters are not available in all places (some VM
environments), so gracefully skip on the particular error condition.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMySQL USDT tool and example (#642)
Brendan Gregg [Mon, 1 Aug 2016 23:18:40 +0000 (16:18 -0700)]
MySQL USDT tool and example (#642)

* MySQL USDT example and tool

* add nodejs example output

* add reference to mysqld example

8 years agoMerge pull request #641 from igorsugak/master
Brendan Gregg [Mon, 1 Aug 2016 17:36:31 +0000 (10:36 -0700)]
Merge pull request #641 from igorsugak/master

tutorial: add missing return in hello_world example

8 years agotutorial: add missing return in hello_world example
Igor Sugak [Mon, 1 Aug 2016 17:19:58 +0000 (10:19 -0700)]
tutorial: add missing return in hello_world example

8 years agoMerge pull request #640 from lcp/fix-docs
Brendan Gregg [Mon, 1 Aug 2016 16:37:48 +0000 (09:37 -0700)]
Merge pull request #640 from lcp/fix-docs

Fix typo in the reference guide

8 years agoFix typo in the reference guide
Gary Lin [Mon, 1 Aug 2016 08:29:16 +0000 (16:29 +0800)]
Fix typo in the reference guide

8 years agoFix tools still referencing ProcUtils (#625)
Teng Qin [Sun, 31 Jul 2016 17:17:07 +0000 (10:17 -0700)]
Fix tools still referencing ProcUtils (#625)

Recent USDT change removed `procstat.py`, which the `argdist` and `trace` tools are still referencing. This diff moves the only method (`which`) they are using into the `BPF` class.

Also, make `BPF.find_library` not to call `decode()` on `None`.

8 years agoTry to demangle C++ symbols (#638)
Teng Qin [Sun, 31 Jul 2016 17:08:07 +0000 (10:08 -0700)]
Try to demangle C++ symbols (#638)

Added a field `demangle_name` in the `bcc_symbol` struct. Calculate its value whenever possible. For C++ programs, this would make outputted stack traces look nicer.
Example: http://pastebin.com/LqT0nP67

8 years agotcpretrans: ntohs dport (#639)
Mark Drayton [Sun, 31 Jul 2016 16:51:52 +0000 (17:51 +0100)]
tcpretrans: ntohs dport (#639)

8 years ago[cachetop] fix stats computation per processes. (#635)
chantra [Fri, 29 Jul 2016 21:10:15 +0000 (14:10 -0700)]
[cachetop] fix stats computation per processes. (#635)

The current logic was only initializing page accesses, mark dirty.. at
the beginning of the method, preventing counters to be ever reset for
each PIDs.

Piggyback https://github.com/iovisor/bcc/pull/615#discussion_r71056842

Tested by running both tools manually.

8 years agoMerge pull request #637 from oujunli/ojl_dev
Brendan Gregg [Fri, 29 Jul 2016 16:58:12 +0000 (09:58 -0700)]
Merge pull request #637 from oujunli/ojl_dev

fix reference_guide.md bpf_get_current_comm search

8 years agofix reference_guide.md bpf_get_current_comm search
Junli Ou [Fri, 29 Jul 2016 08:36:04 +0000 (16:36 +0800)]
fix reference_guide.md bpf_get_current_comm search

8 years agoMerge pull request #636 from iovisor/xdp-drop
Brenden Blanco [Fri, 29 Jul 2016 00:09:15 +0000 (17:09 -0700)]
Merge pull request #636 from iovisor/xdp-drop

Add xdp_drop_count example

8 years agoAdd support to xdp_drop_count for clsact mode
Brenden Blanco [Thu, 28 Jul 2016 23:33:46 +0000 (16:33 -0700)]
Add support to xdp_drop_count for clsact mode

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoAdd xdp_drop_count example
Brenden Blanco [Thu, 28 Jul 2016 22:30:54 +0000 (15:30 -0700)]
Add xdp_drop_count example

This adds the xdp drop count example relicensed under ASL2, along with
some minor modifications to print pkt/s.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMerge pull request #634 from Eichhoernchen/xdp_net-next
Brenden Blanco [Thu, 28 Jul 2016 20:46:48 +0000 (13:46 -0700)]
Merge pull request #634 from Eichhoernchen/xdp_net-next

Added XDP support to BCC

8 years agoThis adds XDP support to BCC as currently supported in net-next.
Jan Rüth [Thu, 28 Jul 2016 20:32:46 +0000 (22:32 +0200)]
This adds XDP support to BCC as currently supported in net-next.

Concretely, it adds two functions to bcc, namely:
`attach_xdp` and `remove_xdp`
which allows to attach an XDP program to a device (given via its name, e.g., en0) (in the future this might change to a specific queue on a device once the kernel offers this interface)
and `remove_xdp` removes a XDP program from a device. Please note that there can currently be only one program attached to the device and attaching another program replaces the previous.

One example is available to test XDP, in networking/xdp which drops all packets an counts for which protocol a packet was dropped (this is taken from the kernel xdp1 example). Please note that you cannot use the network headers defined in <bcc/proto.h> as they cause llvm/clang to generate instructions not available on XDP layer. On XDP layer you do not have an skb yet, so you are operating on the bare packet data.

XDP support is currently limited to only some network adapters, there is the `mlx4` and there is also a patch available for the `e1000` driver.

8 years agoMerge pull request #632 from markdrayton/probe-strings
Brenden Blanco [Wed, 27 Jul 2016 20:07:33 +0000 (13:07 -0700)]
Merge pull request #632 from markdrayton/probe-strings

Probe registration fixes

8 years agoRemove asserts on str probe names
Mark Drayton [Wed, 27 Jul 2016 02:08:20 +0000 (03:08 +0100)]
Remove asserts on str probe names

`open_kprobes` is a dict of open kprobes. Its keys are strings for normal
probes and a tuple for perf buffers. Normal probes need unregistering on script
exit; perf buffers do not. `cleanup` currently looks for string keys
(specifically type `str`) when working out what to unregister, which is a bit
brittle -- in Python2 strings can be both native `str` and `unicode`, depending
what exactly was passed to `attach-*/detach_*` and whether `from __future__
import unicode_literals` is used (e.g. #623).

This diff makes the API more relaxed by casting the probe name to `str` to
match the expectations of `cleanup`. This works in py2 (with and without
unicode_literals) and py3.

8 years agopy3 probe registration compatibility fixes
Mark Drayton [Wed, 27 Jul 2016 04:10:15 +0000 (05:10 +0100)]
py3 probe registration compatibility fixes

* rework `_get_kprobe_functions` to avoid unclosed blacklist warning
* rework `cleanup` to avoid changing size of dict while iterating
* make handling return of `bpf_function_name` work in py2 and py3

8 years agoMerge pull request #630 from chantra/cachetop_sort_ui
Brenden Blanco [Wed, 27 Jul 2016 17:44:10 +0000 (10:44 -0700)]
Merge pull request #630 from chantra/cachetop_sort_ui

[cachetop] Display sorting field and order.

8 years agoMerge pull request #631 from brendangregg/refguide
Brenden Blanco [Wed, 27 Jul 2016 01:12:51 +0000 (18:12 -0700)]
Merge pull request #631 from brendangregg/refguide

add a reference guide

8 years agotypos
Brendan Gregg [Tue, 26 Jul 2016 20:44:30 +0000 (13:44 -0700)]
typos

8 years agofix local links
Brendan Gregg [Tue, 26 Jul 2016 20:38:39 +0000 (13:38 -0700)]
fix local links

8 years agoadd a reference guide
Brendan Gregg [Tue, 26 Jul 2016 20:25:53 +0000 (13:25 -0700)]
add a reference guide

8 years agoMerge pull request #628 from brendangregg/master
Brenden Blanco [Tue, 26 Jul 2016 14:49:06 +0000 (07:49 -0700)]
Merge pull request #628 from brendangregg/master

tutorials: end-user, and python developer

8 years ago[cachetop] Display sorting field and order.
chantra [Tue, 26 Jul 2016 01:32:46 +0000 (18:32 -0700)]
[cachetop] Display sorting field and order.

This will make it easier to visualize what is the sorting field
and order

8 years agoremove unused MSG_MAX
Brendan Gregg [Mon, 25 Jul 2016 23:58:37 +0000 (16:58 -0700)]
remove unused MSG_MAX

8 years agoadd uprobe lesson to tutorial
Brendan Gregg [Mon, 25 Jul 2016 23:13:51 +0000 (16:13 -0700)]
add uprobe lesson to tutorial

8 years agofix uprobe examples to read correct argument
Brendan Gregg [Mon, 25 Jul 2016 23:13:35 +0000 (16:13 -0700)]
fix uprobe examples to read correct argument

8 years agotutorials: end-user, and python developer
Brendan Gregg [Mon, 25 Jul 2016 22:02:32 +0000 (15:02 -0700)]
tutorials: end-user, and python developer

8 years agoMerge pull request #627 from brendangregg/master
Brenden Blanco [Mon, 25 Jul 2016 21:18:54 +0000 (14:18 -0700)]
Merge pull request #627 from brendangregg/master

merge most .c and .py examples

8 years agoreturn 0 on hello_worlds
Brendan Gregg [Sun, 24 Jul 2016 23:19:20 +0000 (16:19 -0700)]
return 0 on hello_worlds

8 years agoadd nodejs_http_server.py to README list
Brendan Gregg [Sun, 24 Jul 2016 20:42:47 +0000 (13:42 -0700)]
add nodejs_http_server.py to README list

8 years agomerge task_switch example
Brendan Gregg [Sun, 24 Jul 2016 20:40:25 +0000 (13:40 -0700)]
merge task_switch example

8 years agomerge disksnoop example
Brendan Gregg [Sun, 24 Jul 2016 20:37:20 +0000 (13:37 -0700)]
merge disksnoop example

8 years agomerge bitehist example
Brendan Gregg [Sun, 24 Jul 2016 20:34:40 +0000 (13:34 -0700)]
merge bitehist example

8 years agoMerge pull request #615 from chantra/cachetop
Brendan Gregg [Sun, 24 Jul 2016 17:01:46 +0000 (10:01 -0700)]
Merge pull request #615 from chantra/cachetop

[cachetop] top-like cachestat

8 years ago[cachetop] fix and doc
chantra [Sat, 23 Jul 2016 13:33:11 +0000 (15:33 +0200)]
[cachetop] fix and doc

* pass -fno-color-diagnostics to clang
* remove unicode import (#623)
* add time to cachetop output
* add keybindings to cachetop.8
* add cachetop links to README.md

8 years ago[cachetop] add example and man page.
chantra [Mon, 18 Jul 2016 22:17:45 +0000 (00:17 +0200)]
[cachetop] add example and man page.

make interval a positional parameter.