@@ -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
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):
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