• Ian Rogers's avatar
    perf top: Allow filters on events · af752016
    Ian Rogers authored
    Allow filters to be added to perf top events. One use is to workaround
    issues with:
    ```
    $ perf top --uid="$(id -u)"
    ```
    which tries to scan /proc find processes belonging to the uid and can
    fail in such a pid terminates between the scan and the
    perf_event_open reporting:
    ```
    Error:
    The sys_perf_event_open() syscall returned with 3 (No such process) for event (cycles:P).
    /bin/dmesg | grep -i perf may provide additional information.
    ```
    A similar filter:
    ```
    $ perf top -e cycles:P --filter "uid == $(id -u)"
    ```
    doesn't fail this way.
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: John Fastabend <john.fastabend@gmail.com>
    Cc: Changbin Du <changbin.du@huawei.com>
    Cc: Yang Jihong <yangjihong1@huawei.com>
    Cc: Andrii Nakryiko <andrii@kernel.org>
    Cc: bpf@vger.kernel.org
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20240524205227.244375-4-irogers@google.com
    af752016
builtin-top.c 49.2 KB