iovisor / iovisor/bcc

Rewrite bcc/tools/biotop with C++ language but the outputs are weird

Open
#1,330 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Hi,

Recently, I rewrite bcc/tools/biotop with C++ language and the source codes of it are here (https://github.com/HarryWei/bcc/blob/master/examples/cpp/IOMigrater.cc). When I execute it, the processes which do synchronous I/O are not printed out consecutively in a while(1) loop, and I also find the size of returned BPF table is ZERO. I cannot understand it. However, when I use bcc/tools/biotop, the outputs work good for me. Can anyone give me some hints? Thank you in advance.

```
# ./IOMigrater
In file included from /virtual/main.c:3:
In file included from /lib/modules/4.7.4/build/include/linux/blkdev.h:9:
In file included from /lib/modules/4.7.4/build/include/linux/genhd.h:64:
In file included from /lib/modules/4.7.4/build/include/linux/device.h:24:
In file included from /lib/modules/4.7.4/build/include/linux/pinctrl/devinfo.h:21:
In file included from /lib/modules/4.7.4/build/include/linux/pinctrl/consumer.h:17:
In file included from /lib/modules/4.7.4/build/include/linux/seq_file.h:10:
/lib/modules/4.7.4/build/include/linux/fs.h:2653:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
if (id < 0 || id >= READING_MAX_ID)
~~ ^ ~
1 warning generated.
Filering I/O intensive threads for 10000 microseconds
This is 0 loop and size is 0
This is 1 loop and size is 0
This is 2 loop and size is 0
This is 3 loop and size is 0
This is 4 loop and size is 0
This is 5 loop and size is 0
This is 6 loop and size is 0
This is 7 loop and size is 0
This is 8 loop and size is 0
This is 9 loop and size is 0
This is 10 loop and size is 0
This is 11 loop and size is 0
This is 12 loop and size is 0
PID 0 handles I/O for 2259014 nanoseconds.
This is 13 loop and size is 1
This is 14 loop and size is 0
This is 15 loop and size is 0
This is 16 loop and size is 0
This is 17 loop and size is 0
...

```

@palmtenor @brendangregg

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing examples/cpp/IOMigrater.cc with bcc/tools/biotop and reproduce the reported output. Trace why the BPF table remains empty and why synchronous-I/O processes are not printed consecutively; done means the C++ tool reports populated results consistently like biotop.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
cli, observability-sre, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.