Commit 480ad81e authored by Brendan Gregg's avatar Brendan Gregg

fixes from mmarchini

parent 5ceb2410
...@@ -58,8 +58,7 @@ To test that the build works, you can try running the test suite, and a one-line ...@@ -58,8 +58,7 @@ To test that the build works, you can try running the test suite, and a one-line
The llvm/clang packages that are currently available for Ubuntu have an issue, so we'll use the ones from llvm.org for now. The build instructions are: The llvm/clang packages that are currently available for Ubuntu have an issue, so we'll use the ones from llvm.org for now. The build instructions are:
``` ```
vi /etc/apt/sources.list cat <<EOF | sudo tee -a /etc/apt/sources.list
---append---
# from https://apt.llvm.org/: # from https://apt.llvm.org/:
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
...@@ -69,10 +68,10 @@ deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main ...@@ -69,10 +68,10 @@ deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
# 6.0 # 6.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
---append--- EOF
apt-get update sudo apt-get update
apt-get install -y bison cmake flex g++ git libelf-dev zlib1g-dev libfl-dev sudo apt-get install -y bison cmake flex g++ git libelf-dev zlib1g-dev libfl-dev
apt-get install clang-5.0 libclang-5.0-dev libclang-common-5.0-dev libclang1-5.0 libllvm5.0 llvm-5.0 llvm-5.0-dev llvm-5.0-runtime sudo apt-get install clang-5.0 libclang-5.0-dev libclang-common-5.0-dev libclang1-5.0 libllvm5.0 llvm-5.0 llvm-5.0-dev llvm-5.0-runtime
git clone https://github.com/iovisor/bpftrace git clone https://github.com/iovisor/bpftrace
cd bpftrace cd bpftrace
mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=DEBUG .. mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=DEBUG ..
......
...@@ -387,8 +387,8 @@ Attaching 1 probe... ...@@ -387,8 +387,8 @@ Attaching 1 probe...
Syntax: Syntax:
``` ```
profile:hz:rate interval:hz:rate
profile:s:rate interval:s:rate
``` ```
This fires on one CPU only, and can be used for generating per-interval output. This fires on one CPU only, and can be used for generating per-interval output.
...@@ -926,6 +926,31 @@ Attaching 2 probes... ...@@ -926,6 +926,31 @@ Attaching 2 probes...
# Map Functions # Map Functions
Maps are special BPF data types that can be used to store counts, statistics, and histograms. They are also used for some variable types as discussed in the previous section, whenever `@` is used: [globals](#21-global), [per thread variables](#22-per-thread), and [associative arrays](#3--associative-arrays).
When bpftrace exits, all maps are printed. For example (the `count()` function is covered in the sections that follow):
```
# bpftrace -e 'kprobe:vfs_read { @[comm] = count(); }'
Attaching 1 probe...
^C
@[systemd]: 6
@[vi]: 7
@[sshd]: 16
@[snmpd]: 321
@[snmp-pass]: 374
```
The map was printed after the Ctrl-C to end the program. If you use maps that you do not wish to be automatically printed on exit, you can add an END block that clears the maps. For example:
```
END
{
clear(@start);
}
```
## 1. Builtins ## 1. Builtins
- `count()` - Count the number of times this function is called - `count()` - Count the number of times this function is called
......
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