platform/upstream/bcc.git
9 years agoMerge pull request #198 from iovisor/bblanco_dev
4ast [Thu, 10 Sep 2015 00:17:50 +0000 (17:17 -0700)]
Merge pull request #198 from iovisor/bblanco_dev

Autoload kprobes for all types of trace_* functions

9 years agoTypo in retprobe case of _trace_autoload
Brenden Blanco [Wed, 9 Sep 2015 20:50:39 +0000 (13:50 -0700)]
Typo in retprobe case of _trace_autoload

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAutoload kprobes for all types of trace_* functions
Brenden Blanco [Wed, 9 Sep 2015 18:55:38 +0000 (11:55 -0700)]
Autoload kprobes for all types of trace_* functions

The previous patch #195 for autoloading of kprobes only did it for
trace_print. Turn this feature on for all trace_* functions. This
requires that these functions are also no longer staticmethods.

Enable the feature in examples/disksnoop.py

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #197 from iovisor/bblanco_dev
4ast [Wed, 9 Sep 2015 19:17:16 +0000 (12:17 -0700)]
Merge pull request #197 from iovisor/bblanco_dev

Fix breakage in bpf_probe_read from #196

9 years agoFix breakage in bpf_probe_read from #196
Brenden Blanco [Wed, 9 Sep 2015 19:12:30 +0000 (12:12 -0700)]
Fix breakage in bpf_probe_read from #196

Argument needs to be cast to u64, otherwise it is adding a whole pointer
stride.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #196 from iovisor/bblanco_dev2
4ast [Wed, 9 Sep 2015 18:01:03 +0000 (11:01 -0700)]
Merge pull request #196 from iovisor/bblanco_dev2

Add debug and fix the inline replace of kprobe args

9 years agoFix the inline replace of kprobe args
Brenden Blanco [Wed, 9 Sep 2015 05:16:10 +0000 (22:16 -0700)]
Fix the inline replace of kprobe args

The way in which args 1+ were being replaced in the C file was
fragile. Instead, assign the registers from ptregs into the function
arguments as the first statement(s) in the body of the function.
e.g.:
int sys_clone(struct ptregs *ctx, struct request *req) {
  // do something with req
}
becomes:
int sys_clone(struct ptregs *ctx, struct request *req) {
  req = ctx->di;
  // do something with req

Fixes: #192
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAdd debug flag for printing rewritten C text
Brenden Blanco [Wed, 9 Sep 2015 05:11:46 +0000 (22:11 -0700)]
Add debug flag for printing rewritten C text

* Many times it is useful to print out the C file after the
  BFrontendAction has run.
  e.g.: BPF("file.c", debug=0x4)

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #195 from iovisor/bblanco_dev
4ast [Wed, 9 Sep 2015 17:54:01 +0000 (10:54 -0700)]
Merge pull request #195 from iovisor/bblanco_dev

Change auto-loading behavior of trace_print

9 years agoDenote auto-loading with k[ret]probe__ prefix
Brenden Blanco [Wed, 9 Sep 2015 05:58:49 +0000 (22:58 -0700)]
Denote auto-loading with k[ret]probe__ prefix

Since kprobe functions will have a different prototype than the kernel
symbols they are attaching to, require that the user prefix the trace
function with a kprobe__ name to denote intent. kretprobe__ prefix is
also supported.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoChange auto-loading behavior of trace_print
Brenden Blanco [Wed, 9 Sep 2015 01:38:59 +0000 (18:38 -0700)]
Change auto-loading behavior of trace_print

* As @brendangregg pointed out, users will probably assume that
  handily-named C functions that can be auto-loaded will be all the
  time, rather than just in the singleton case. This is pretty easy to
  implement, so changing the behavior.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #194 from iovisor/bblanco_dev
4ast [Wed, 9 Sep 2015 01:18:25 +0000 (18:18 -0700)]
Merge pull request #194 from iovisor/bblanco_dev

Support automatic kprobe event detection in common case

9 years agoSupport automatic kprobe event detection in common case
Brenden Blanco [Wed, 9 Sep 2015 00:35:25 +0000 (17:35 -0700)]
Support automatic kprobe event detection in common case

* In the simple case, a user only creates 1 C function to be used with
  kprobes. Detect this common case and don't require the user to repeat
  themselves by passing the fn_name to attach_kprobe().
  e.g.: BPF(text='int sys_clone(void *ctx) {/*do stuff*/}').trace_print()

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #189 from iovisor/bblanco_dev
4ast [Tue, 8 Sep 2015 15:30:31 +0000 (08:30 -0700)]
Merge pull request #189 from iovisor/bblanco_dev

Suppress None return when trace_pipe drops lines

9 years agoSuppress None return when trace_pipe drops lines
Brenden Blanco [Tue, 8 Sep 2015 05:52:23 +0000 (22:52 -0700)]
Suppress None return when trace_pipe drops lines

* When a "CPU: X Lost N events" line came on the trace_pipe,
  trace_fields would return None and cause exceptions in callers that do
  (a, b, ...) = b.trace_fields() type of calls. Instead, keep reading
  from trace_pipe when such messages come.

Fixes: #187
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #184 from iovisor/bblanco_dev
Brenden Blanco [Tue, 8 Sep 2015 05:52:09 +0000 (22:52 -0700)]
Merge pull request #184 from iovisor/bblanco_dev

Add BPF_HASH macro with variadic arguments

9 years agoMerge pull request #185 from brendangregg/master
Brenden Blanco [Tue, 8 Sep 2015 04:37:33 +0000 (21:37 -0700)]
Merge pull request #185 from brendangregg/master

print_log2_hist() for #143

9 years agoshorten hello world example
Brendan Gregg [Mon, 7 Sep 2015 21:51:53 +0000 (14:51 -0700)]
shorten hello world example

9 years agono longer need the clear()
Brendan Gregg [Mon, 7 Sep 2015 21:46:14 +0000 (14:46 -0700)]
no longer need the clear()

9 years agomake bitehist a simpler example of log2 histograms
Brendan Gregg [Mon, 7 Sep 2015 21:42:12 +0000 (14:42 -0700)]
make bitehist a simpler example of log2 histograms

9 years agoadd print_log2_hist() from #143
Brendan Gregg [Mon, 7 Sep 2015 21:34:22 +0000 (14:34 -0700)]
add print_log2_hist() from #143

9 years agoMerge remote-tracking branch 'upstream/master'
Brendan Gregg [Mon, 7 Sep 2015 20:28:43 +0000 (13:28 -0700)]
Merge remote-tracking branch 'upstream/master'

9 years agoShorten trace_readline_fields to trace_fields
Brenden Blanco [Sat, 5 Sep 2015 04:20:59 +0000 (21:20 -0700)]
Shorten trace_readline_fields to trace_fields

* Per suggestion in #149

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAdd BPF_HASH macro with variadic arguments
Brenden Blanco [Sun, 6 Sep 2015 04:54:59 +0000 (21:54 -0700)]
Add BPF_HASH macro with variadic arguments

* Usage: BPF_HASH(tablename, key_type=u64, leaf_type=u64)
  2nd and 3rd arguments are optional in the C++ default argument style

Fixes: #135
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #183 from iovisor/bblanco_dev
4ast [Sat, 5 Sep 2015 05:24:26 +0000 (22:24 -0700)]
Merge pull request #183 from iovisor/bblanco_dev

Shorten trace_readline_fields to trace_fields

9 years agoShorten trace_readline_fields to trace_fields
Brenden Blanco [Sat, 5 Sep 2015 04:20:59 +0000 (21:20 -0700)]
Shorten trace_readline_fields to trace_fields

* Per suggestion in #149

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #182 from brendangregg/master
Brenden Blanco [Sat, 5 Sep 2015 02:12:23 +0000 (19:12 -0700)]
Merge pull request #182 from brendangregg/master

simplify code using new features

9 years agosimplify code using new features
Brendan Gregg [Sat, 5 Sep 2015 00:42:51 +0000 (17:42 -0700)]
simplify code using new features

9 years agoMerge pull request #181 from iovisor/bblanco_dev
4ast [Fri, 4 Sep 2015 22:21:53 +0000 (15:21 -0700)]
Merge pull request #181 from iovisor/bblanco_dev

Reorganize cmake, some cleanups and test fixes.

9 years agoThe use of schedule+<offset> was unstable, remove it
Brenden Blanco [Fri, 4 Sep 2015 21:56:31 +0000 (14:56 -0700)]
The use of schedule+<offset> was unstable, remove it

* After a kernel update, the binary of schedule function changed offset,
  and the attachment point updated. Since this is just a test case, pick
  a different function to test.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoRemove std::exception code from exception.h
Brenden Blanco [Fri, 4 Sep 2015 21:55:35 +0000 (14:55 -0700)]
Remove std::exception code from exception.h

* The c++ exception code was unused, now it is just c macro style
  "exceptions"

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoReorganize cmake files into dedicated cmake directory
Brenden Blanco [Fri, 4 Sep 2015 16:36:37 +0000 (09:36 -0700)]
Reorganize cmake files into dedicated cmake directory

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #180 from iovisor/bblanco_dev
4ast [Fri, 4 Sep 2015 15:14:54 +0000 (08:14 -0700)]
Merge pull request #180 from iovisor/bblanco_dev

Update README.md and INSTALL.md, specfile dependencies

9 years agoSome more minor updates to INSTALL and README
Brenden Blanco [Fri, 4 Sep 2015 07:08:19 +0000 (00:08 -0700)]
Some more minor updates to INSTALL and README

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAdd spec and build script used in fedora buildbot
Brenden Blanco [Fri, 4 Sep 2015 06:24:49 +0000 (23:24 -0700)]
Add spec and build script used in fedora buildbot

* These files are required to build the test rpm

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMinor updates to install doc and add dep to spec files
Brenden Blanco [Fri, 4 Sep 2015 05:07:13 +0000 (22:07 -0700)]
Minor updates to install doc and add dep to spec files

* Add some runtime dependencies in INSTALL.md
* make and gcc are required at runtime, so add them to libbcc Requires:

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoUpdates to README and INSTALL documents
Brenden Blanco [Thu, 3 Sep 2015 23:31:47 +0000 (16:31 -0700)]
Updates to README and INSTALL documents

* Some changes to python API examples
* Reflect non-rc kernel availability in install doc
* Add binary rpm section to install doc
* Remove docker build instructions

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #178 from iovisor/llvm_fixes
4ast [Thu, 3 Sep 2015 19:01:18 +0000 (12:01 -0700)]
Merge pull request #178 from iovisor/llvm_fixes

Fixes for when using clang/llvm as CC/CXX

9 years agoMerge pull request #177 from iovisor/bblanco_dev
4ast [Thu, 3 Sep 2015 18:56:30 +0000 (11:56 -0700)]
Merge pull request #177 from iovisor/bblanco_dev

Enhance check for presence of static-libstdc++

9 years agoWorkaround for uninitialized union clang bug
Brenden Blanco [Thu, 3 Sep 2015 18:49:54 +0000 (11:49 -0700)]
Workaround for uninitialized union clang bug

* Clang does not generate code to initialize the entire union when
  initializing a nested struct. This is the case for union bpf_attr.
  As a workaround, call memset explicitly.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoFix compiler warnings when using clang[++]
Brenden Blanco [Thu, 3 Sep 2015 18:46:35 +0000 (11:46 -0700)]
Fix compiler warnings when using clang[++]

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoEnhance check for presence of static-libstdc++
Brenden Blanco [Thu, 3 Sep 2015 18:12:17 +0000 (11:12 -0700)]
Enhance check for presence of static-libstdc++

* Fixes a link error on Ubuntu when static-libstdc++ is not installed.

Reported-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #176 from iovisor/bblanco_dev v0.1.6
4ast [Thu, 3 Sep 2015 05:03:40 +0000 (22:03 -0700)]
Merge pull request #176 from iovisor/bblanco_dev

Include missed spec files in s/bpf/bcc/ rename

9 years agoInclude missed spec files in s/bpf/bcc/ rename
Brenden Blanco [Thu, 3 Sep 2015 05:00:12 +0000 (22:00 -0700)]
Include missed spec files in s/bpf/bcc/ rename

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #175 from iovisor/bblanco_dev
4ast [Thu, 3 Sep 2015 01:25:45 +0000 (18:25 -0700)]
Merge pull request #175 from iovisor/bblanco_dev

Rename python module name to 'bcc' from 'bpf'

9 years agoRename python module name to 'bcc' from 'bpf'
Brenden Blanco [Thu, 3 Sep 2015 01:04:07 +0000 (18:04 -0700)]
Rename python module name to 'bcc' from 'bpf'

* Rename python module to bcc
* Rename python-bpf (deb,rpm) package to python-bcc
* Pending this change, I will likely re-tag 0.1.6, and upload the bcc
  package to pypi.python.org

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #174 from iovisor/bblanco_dev
yonghong-song [Wed, 2 Sep 2015 18:33:11 +0000 (11:33 -0700)]
Merge pull request #174 from iovisor/bblanco_dev

Update tag to v0.1.6, include finall llvm 3.7.0 release

9 years agoAdd debian builder script that is versioned
Brenden Blanco [Wed, 2 Sep 2015 17:26:59 +0000 (10:26 -0700)]
Add debian builder script that is versioned

* This script can be run by buildbot to generate the debian files
e.g.: PARALLEL=4 scripts/build-deb.sh

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoFix debian changelog formatting
Brenden Blanco [Wed, 2 Sep 2015 16:23:56 +0000 (09:23 -0700)]
Fix debian changelog formatting

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoUpdate tag to v0.1.6, include finall llvm 3.7.0 release
Brenden Blanco [Wed, 2 Sep 2015 06:19:27 +0000 (23:19 -0700)]
Update tag to v0.1.6, include finall llvm 3.7.0 release

* Update llvm to 3.7.0 release

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #173 from iovisor/bblanco_dev
4ast [Tue, 1 Sep 2015 16:45:23 +0000 (09:45 -0700)]
Merge pull request #173 from iovisor/bblanco_dev

Add RPM packaging for el6,el7,fedora22

9 years agoAdd RPM packaging for el6,el7,fedora22
Brenden Blanco [Tue, 1 Sep 2015 01:19:33 +0000 (18:19 -0700)]
Add RPM packaging for el6,el7,fedora22

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #171 from iovisor/bblanco_dev
4ast [Mon, 31 Aug 2015 21:15:25 +0000 (14:15 -0700)]
Merge pull request #171 from iovisor/bblanco_dev

Minor change to task_switch example syntax

9 years agoMerge pull request #172 from brendangregg/master
Brenden Blanco [Sat, 29 Aug 2015 15:08:01 +0000 (08:08 -0700)]
Merge pull request #172 from brendangregg/master

initial ksym() and ksymaddr()

9 years agoMerge remote-tracking branch 'upstream/master'
Brendan Gregg [Sat, 29 Aug 2015 08:32:34 +0000 (18:32 +1000)]
Merge remote-tracking branch 'upstream/master'

9 years agoMinor change to task_switch example syntax
Brenden Blanco [Sat, 29 Aug 2015 06:15:19 +0000 (23:15 -0700)]
Minor change to task_switch example syntax

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #170 from iovisor/bblanco_dev
4ast [Sat, 29 Aug 2015 05:56:50 +0000 (22:56 -0700)]
Merge pull request #170 from iovisor/bblanco_dev

Add beta RPM spec and docker script for centos

9 years agoAdd another spec dependency
Brenden Blanco [Sat, 29 Aug 2015 05:53:56 +0000 (22:53 -0700)]
Add another spec dependency

Testing buildbot

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAdd one dependency to spec
Brenden Blanco [Sat, 29 Aug 2015 05:45:27 +0000 (22:45 -0700)]
Add one dependency to spec

Also, testing buildbot with this tiny change

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agomake use of BPF.ksym()
Brendan Gregg [Sat, 29 Aug 2015 05:14:07 +0000 (15:14 +1000)]
make use of BPF.ksym()

9 years agoprovide ksym() and ksymaddr()
Brendan Gregg [Sat, 29 Aug 2015 05:12:57 +0000 (15:12 +1000)]
provide ksym() and ksymaddr()

9 years agouse new event_re option to improve vfscount
Brendan Gregg [Sat, 29 Aug 2015 04:53:22 +0000 (14:53 +1000)]
use new event_re option to improve vfscount

9 years agoAdd beta RPM spec and docker script for centos
Brenden Blanco [Sat, 29 Aug 2015 04:44:35 +0000 (21:44 -0700)]
Add beta RPM spec and docker script for centos

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #168 from iovisor/weichunc_dev
Brenden Blanco [Thu, 27 Aug 2015 07:59:34 +0000 (00:59 -0700)]
Merge pull request #168 from iovisor/weichunc_dev

Add gretap support for full mesh tunnel

9 years agoAdd gretap support for full mesh tunnel
Wei-Chun Chao [Wed, 26 Aug 2015 21:57:21 +0000 (14:57 -0700)]
Add gretap support for full mesh tunnel

Signed-off-by: Wei-Chun Chao <weichunc@plumgrid.com>
9 years agoMerge pull request #166 from iovisor/bblanco_dev
4ast [Wed, 26 Aug 2015 14:49:41 +0000 (07:49 -0700)]
Merge pull request #166 from iovisor/bblanco_dev

Add proper debian build support, rename libbcc.so

9 years agoMerge pull request #167 from brendangregg/master
Brenden Blanco [Wed, 26 Aug 2015 13:46:37 +0000 (06:46 -0700)]
Merge pull request #167 from brendangregg/master

improve examples using new features

9 years agoimprove code by utilizing trace_readline_fields()
Brendan Gregg [Wed, 26 Aug 2015 10:16:29 +0000 (20:16 +1000)]
improve code by utilizing trace_readline_fields()

9 years agoimprove code by utilizing .clear()
Brendan Gregg [Wed, 26 Aug 2015 10:15:18 +0000 (20:15 +1000)]
improve code by utilizing .clear()

9 years agoSupport versioning out of git tree in debuild
Brenden Blanco [Wed, 26 Aug 2015 07:13:23 +0000 (00:13 -0700)]
Support versioning out of git tree in debuild

This adds support for properly tagging the build when cmake is run not
in a git tree, which is the case when building from src-deb.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAdd proper debian build support
Brenden Blanco [Wed, 26 Aug 2015 06:14:25 +0000 (23:14 -0700)]
Add proper debian build support

The cmake based build system is nice, but not quite production ready.
Move to the more painful but featureful debuild style. This is one step
towards an upstreamable package.

Rename libbpfprog (ugh) to libbcc.

Split out python-bpf and libbcc-examples into separate packages that
depend on libbcc.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #165 from iovisor/bblanco_dev
4ast [Wed, 26 Aug 2015 05:43:22 +0000 (22:43 -0700)]
Merge pull request #165 from iovisor/bblanco_dev

Fix print() breakage in python 2.7 environments

9 years agoFix print() breakage in python 2.7 environments
Brenden Blanco [Wed, 26 Aug 2015 05:40:21 +0000 (22:40 -0700)]
Fix print() breakage in python 2.7 environments

Fixes: #164
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #163 from iovisor/bblanco_dev
4ast [Tue, 25 Aug 2015 14:36:16 +0000 (07:36 -0700)]
Merge pull request #163 from iovisor/bblanco_dev

Add debug flag to enable prints from kernel verifier

9 years agotest_trace4 is unreliable, use a different test regex
Brenden Blanco [Tue, 25 Aug 2015 06:55:59 +0000 (23:55 -0700)]
test_trace4 is unreliable, use a different test regex

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoAdd debug flag to enable prints from kernel verifier
Brenden Blanco [Tue, 25 Aug 2015 06:42:42 +0000 (23:42 -0700)]
Add debug flag to enable prints from kernel verifier

Add flag to BPF() to enable debug prints from the verifier. Use by
passing 0x2 to debug= in the constructor. Add docstring for BPF
constructor.

Also, optimize bpf_prog_load so that by default the kernel is not
asked to print the verbose output. The program will be "loaded" a second
time to capture the verifier failure message.

Fixes: #147
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #162 from iovisor/bblanco_dev
4ast [Tue, 25 Aug 2015 05:02:49 +0000 (22:02 -0700)]
Merge pull request #162 from iovisor/bblanco_dev

Add regex support to attach_k[ret]probe

9 years agoAdd regex support to attach_k[ret]probe
Brenden Blanco [Tue, 25 Aug 2015 04:33:25 +0000 (21:33 -0700)]
Add regex support to attach_k[ret]probe

Add new event_re parameter to kprobe functions. This searches through
the list of functions/symbols in <tracefs>/available_filter_functions
for all matching functions. Every one is attached.

Add a test case for attach_k[ret]probe.

Fixes: #141
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #161 from svinota/master
yonghong-song [Mon, 24 Aug 2015 23:15:48 +0000 (16:15 -0700)]
Merge pull request #161 from svinota/master

examples: use IPDB `wait_ip()` feature

9 years agoexamples: use IPDB `wait_ip()` feature
Peter V. Saveliev [Mon, 24 Aug 2015 19:55:35 +0000 (21:55 +0200)]
examples: use IPDB `wait_ip()` feature

9 years agoMerge pull request #160 from iovisor/bblanco_dev
4ast [Mon, 24 Aug 2015 19:23:09 +0000 (12:23 -0700)]
Merge pull request #160 from iovisor/bblanco_dev

Add field support to trace_print and friends

9 years agoAdd field support to trace_print and friends
Brenden Blanco [Mon, 24 Aug 2015 19:06:36 +0000 (12:06 -0700)]
Add field support to trace_print and friends

Add trace_readline_fields helper to parse the output of trace_pipe
Add field parsing support to trace_print. Addresses #149.
Fix typo in trace_open s/trace/tracefile/
Make nonblocking=False the default in trace_readline
Use IOError vs BlockingIOError for greater compatibility (untested)

Fixes: #149
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #158 from iovisor/bblanco_dev
4ast [Mon, 24 Aug 2015 16:55:57 +0000 (09:55 -0700)]
Merge pull request #158 from iovisor/bblanco_dev

Fix map.clear() usage for array type maps

9 years agoFix map.clear() usage for array type maps
Brenden Blanco [Mon, 24 Aug 2015 05:59:38 +0000 (22:59 -0700)]
Fix map.clear() usage for array type maps

Calling delete on an array type map entry does not have an effect.
Instead, the entry needs to be zeroed out, since the array slot always
exists. To avoid unnecessary calls to update(), only call update() when
the map type is array-like. The type was not exposed to python up until
now, so add it.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #157 from iovisor/bblanco_dev
4ast [Sat, 22 Aug 2015 16:55:09 +0000 (09:55 -0700)]
Merge pull request #157 from iovisor/bblanco_dev

Add test case for clearing of maps from python

9 years agoAdd test case for clearing of maps from python
Brenden Blanco [Sat, 22 Aug 2015 15:33:29 +0000 (08:33 -0700)]
Add test case for clearing of maps from python

Fixes: #142
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #156 from iovisor/bblanco_dev
4ast [Fri, 21 Aug 2015 23:37:01 +0000 (16:37 -0700)]
Merge pull request #156 from iovisor/bblanco_dev

Add BPF python helpers for reading trace_pipe

9 years agoAdd BPF python helpers for reading trace_pipe
Brenden Blanco [Fri, 21 Aug 2015 23:33:02 +0000 (16:33 -0700)]
Add BPF python helpers for reading trace_pipe

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #153 from brendangregg/master
Brenden Blanco [Thu, 20 Aug 2015 19:56:35 +0000 (12:56 -0700)]
Merge pull request #153 from brendangregg/master

more examples of b[] syntax, fix func arg passing

9 years agotidier example
Brendan Gregg [Thu, 20 Aug 2015 19:52:30 +0000 (12:52 -0700)]
tidier example

9 years agomore examples of b[] syntax, fix func arg passing
Brendan Gregg [Thu, 20 Aug 2015 19:40:37 +0000 (12:40 -0700)]
more examples of b[] syntax, fix func arg passing

9 years agoMerge pull request #152 from iovisor/bblanco_dev
4ast [Thu, 20 Aug 2015 18:46:42 +0000 (11:46 -0700)]
Merge pull request #152 from iovisor/bblanco_dev

Add getitem api to BPF object to reference tables

9 years agoAdd getitem api to BPF object to reference tables
Brenden Blanco [Thu, 20 Aug 2015 18:27:21 +0000 (11:27 -0700)]
Add getitem api to BPF object to reference tables

To simplify some common usage patterns, add a getitem api to the BPF
class. This wraps the get_table() api and allows the api user to skip
keeping their own get_table handle.

Fixes: #137
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #151 from iovisor/bblanco_dev
4ast [Wed, 19 Aug 2015 22:48:30 +0000 (15:48 -0700)]
Merge pull request #151 from iovisor/bblanco_dev

Change API of attach_kprobe to take a name argument

9 years agoChange API of attach_kprobe to take a name argument
Brenden Blanco [Wed, 19 Aug 2015 22:39:19 +0000 (15:39 -0700)]
Change API of attach_kprobe to take a name argument

Per feedback on the attach_kprobe api, change up the arguments to remove
the load_func that typically preceeds the call. Instead, move this
inside the attach_kprobe implementation. Also, this makes attach_kprobe
need to be non-static. The same applies to attach_kretprobe.

Old:
fn = b.load_func("hello", BPF.KPROBE)
BPF.attach_kprobe(fn, "sys_clone")

New:
b.attach_kprobe(event="sys_clone", fn_name="hello")

Note that the kwarg style is not required, but I fixed up the current
usages to provide readability.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
9 years agoMerge pull request #150 from brendangregg/master
Brenden Blanco [Wed, 19 Aug 2015 00:55:32 +0000 (17:55 -0700)]
Merge pull request #150 from brendangregg/master

some bcc examples and tools

9 years agosave some syscalls
Brendan Gregg [Tue, 18 Aug 2015 23:53:41 +0000 (16:53 -0700)]
save some syscalls

9 years agopython 2 & 3 compatibility
Brendan Gregg [Tue, 18 Aug 2015 23:49:48 +0000 (16:49 -0700)]
python 2 & 3 compatibility

9 years agosupport odd Linux distros
Brendan Gregg [Tue, 18 Aug 2015 23:11:35 +0000 (16:11 -0700)]
support odd Linux distros

9 years agocleaner get_table calls
Brendan Gregg [Tue, 18 Aug 2015 22:34:56 +0000 (15:34 -0700)]
cleaner get_table calls