0

I've applied CPUAffinity to certain systemd services. I've checked Cpus_allowed_list from /proc/PID/status, and it works fine.

Now I want to find out which process is using CPU 0 or CPU 1, how can I do that? the top or htop command does not seem to support such thing.

1
  • I am afraid you just cannot get any valuable information about this when the information would be interesting that is when the system starts being loaded. Because as soon as you'll have launched whatever process for getting that information, the scheduler is likely to reshuffle many things. The less worse solution being to launch whatever monitoring process on another NUMA node.
    – MC68020
    Oct 19, 2022 at 15:06

2 Answers 2

1

perf top -C 0,1 would give you insight into what is using how much time on the 0. and 1. cores. Attach --sort comm if you don't care about individual functions, but only about process names occupying the CPU.

Run it as root to get insight into kernel usage as well. If you run it as unprivileged user, you will have to do sudo sysctl -w kernel.perf_event_paranoid=-1 to allow normal users to sniff around what the CPU does at any given time.

1

Type f in top and cursor over to Last Used CPU (P) and toggle it on with space.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .