This adds `perf_event` program type as a template entry.
The new entry comes with a skeleton example which register
scheduled events on each CPU at 1 HZ, triggered by the kernel
(based on clock ticks). The corresponding BPF logic logs each
event, and can identify kernel tasks from userland processes.
Fix template so that the generated code would not have any
clippy issues (per `cargo +nightly clippy`).
Add template conditionals on the program_type to avoid
a warning about unused 'opt' variable.
Fixes#66.
An error during `BpfLogger` initialization most likely means that
`ayalog-ebpf` is not used in the eBPF crate.
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Use `aya = ">=0.11"` and therefore the Aya version picked by
Cargo will be bounded by the latest version supported in
`aya-log = "0.1"` - once it's been released again.
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
This time we need to switch to git again, because of this unreleased
change:
aya-rs/aya@d1f2215193
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
structopt was merged into clap (starting from clap 3.0), therefore
becoming a deprecated project.
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
This change removes the differentiation between release and dev profiles
for eBPF programs. There is no way eBPF programs can be debugged and
building them with dev profile just makes them slower and often unable
to be verified. They should be always built with the release profile.
After this change, `cargo xtask build-ebpf` is going to build eBPF
programs with release profile. And the userspace program is going to
include eBPF program bytes from target/release/. Regardless of which
profile is being used in the userspace program.
`cargo xtask build-ebpf` has the --profile argument which can be
optionally used (i.e. for user-defined profiles), but by default the
value of that option is `release`.
Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
Avoid unused_imports warning for std::convert::TryFrom.
Conditionally import it only when it is needed -
in sk_msg programs.
remove unused `std::convert::TryFrom` import to avoid the warning in the generated projects:
```
warning: unused import: `TryFrom`
--> myapp/src/main.rs:4:15
|
4 | convert::{TryFrom,TryInto},
| ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `myapp` (bin "myapp") generated 1 warning
```