Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to monitor bpf programs. #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jul 9, 2020

  1. Add support to monitor bpf programs.

    BPF is very important component for modern Linux systems, and getting more
    features and adoptions. This commit enables atop to monitor BPF programs.
    
    The output looks like:
    
    ATOP - kerneltest002       2020/06/16  17:01:12       --------------       10s elapsed
    PRC |  sys    2.72s |  user   4.85s |  #proc    761  | #zombie    0  | #exit    250  |
    CPU |  sys      29% |  user     50% |  irq       0%  | idle   7915%  | wait      8%  |
    CPL |  avg1    1.68 |  avg5    1.05 |  avg15   0.72  | csw   160979  | intr   66341  |
    [...]
    BPF_PROG_ID                       NAME  TOTAL_TIME_NS      RUN_CNT     CPU AVG_TIME_NS
            894            tracepoint__sch          83882           11      0%     7625.64
            893            tracepoint__sch          43231            5      0%     8646.20
            892            tracepoint__tas          34818            4      0%     8704.50
        PID SYSCPU USRCPU  VGROW  RGROW  RDDSK  WRDSK EXC  THR S CPUNR  CPU CMD      1/113
    2669644  0.45s  1.08s 603.1M 23100K     0K     0K   -   10 S    59  15% squashfuse_ll
    
    To build atop with BPF monitoring, we need pass in option to make as:
    
        ATOP_BPF_SUPPORT=1 make -j
    
    Atop periodically enables monitoring of BPF programs calling:
        bpf_enable_stats(BPF_STATS_RUN_TIME);
    
    Since monitoring of BPF program has non-trivial overhead to the bpf
    programs, the following options are added to only monitor BPF program
    less often:
    
        bpfsamplerate, default 1
        bpfsampleinterval, default 1
    
    bpf stats is enabled for bpfsampleinterval seconds every bpfsamplerate
    atop intervals. bpfsampleinterval must be smaller than atop interval.
    
    Changes v1 => v2:
    1. Instead of using unsafe sysctl, using a safe new API to enable BPF
       runtime stats.
    2. Change output columns: remove "TYPE", add "CPU" for cpu %.
    liu-song-6 committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    abe5f48 View commit details
    Browse the repository at this point in the history