How to know the load on each core in real time?

How can I get information about the operation of the processor in real time:
Code:
 root@F3ja:/usr/home/luba # sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
hw.machine: amd64
hw.model: AMD Ryzen 7 5825U with Radeon Graphics         
hw.ncpu: 16
hw.machine_arch: amd64
 
What do you mean by "real time"? Is second-by-second averages OK? And are details like "which CPU is which" important? If not:

No extra software required. Start top. Press the "h" key, for help. Look at the instructions, they fit on a page. Read the instructions. You'll find that it says "P" shows the statistics per CPU. There are many other interesting one-character commands you can type, so explore top a little bit.

Now to the complexities. Modern high-end server CPUs can have a very large number of cores, and hyperthreading etc. can increase the number of CPUs visible to the OS. If you are on a machine with 128 or 256 CPUs, these techniques stop working, since the top output no longer fits on a single screen. You seem to have 8 real CPUs (and 16 hyperthreaded ones), so for you top will probably work in a large window.

Next the real-time question: Top gives you averages for the last second or more. You can go for finer-grain sensing (with the -s command line switch), but the output quickly becomes unreadable. It also completely misses what is probably the single most important question in optimizing for multi-core machines: How often do process migrate between cores, and what is the memory affinity? I don't know whether your machine (with a single Ryzen chip) is particularly NUMA-ish: It has two memory channel interfaces, but I don't know whether those apply to separate caches and CPU clusters. If it is homogeneous, then process migration will not be a huge performance issue for you (except for loss of per-core L1/L2 cache content). On the other hand, if the L3 cache is split between the memory interfaces, you might want to look at affinity; for that, top is too coarse a tool, and both measuring and optimizing it is difficult.

Finally: I think your Ryzen CPU has only one kind of core, all 8 of them at the same speed and capability. Today, there are other CPUs that have a mix of dissimilar cores, some optimized for raw speed, others optimized for power efficiency. When tuning on those, tools like top again become insufficient, since you need to see (and control) how tasks are assigned to different flavors of CPUs.
 
Specifically, for each core, which cores are working in real time, which are idle, and about processor threads ..?
 
May be gnome-system-monitor ? No.
top is the best.
top -P 0
last pid: 1737; load averages: 0,28, 0,15, 0,06 up 0+00:02:40 11:41:21
93 processes: 1 running, 92 sleeping
CPU 0: 0,0% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,8% idle
CPU 1: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 2: 0,2% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 3: 0,0% user, 0,4% nice, 0,2% system, 0,0% interrupt, 99,4% idle
CPU 4: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 5: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 6: 0,0% user, 0,0% nice, 0,0% system, 0,6% interrupt, 99,4% idle
CPU 7: 0,4% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,6% idle
CPU 8: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 9: 0,2% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 10: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 11: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 12: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 13: 0,0% user, 0,2% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 14: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 15: 0,0% user, 0,0% nice, 0,6% system, 0,0% interrupt, 99,4% idle
CPU 16: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 17: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 18: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 19: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 20: 0,2% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,6% idle
CPU 21: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 22: 0,0% user, 0,0% nice, 0,2% system, 0,2% interrupt, 99,6% idle
CPU 23: 0,2% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,6% idle
CPU 24: 0,0% user, 0,9% nice, 0,0% system, 0,2% interrupt, 98,9% idle
CPU 25: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 26: 0,0% user, 0,2% nice, 0,2% system, 0,0% interrupt, 99,6% idle
CPU 27: 0,0% user, 20,1% nice, 2,4% system, 0,0% interrupt, 77,4% idle
CPU 28: 0,4% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,6% idle
CPU 29: 0,2% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 30: 0,5% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,5% idle
CPU 31: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 32: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 33: 0,0% user, 0,0% nice, 0,6% system, 0,0% interrupt, 99,4% idle
CPU 34: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 35: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 36: 0,0% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,8% idle
CPU 37: 0,2% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 38: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 39: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 40: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 41: 0,0% user, 0,2% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 42: 0,0% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,8% idle
CPU 43: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 44: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 45: 0,2% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,6% idle
CPU 46: 0,2% user, 0,0% nice, 0,5% system, 0,0% interrupt, 99,3% idle
CPU 47: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 48: 0,6% user, 0,0% nice, 0,6% system, 0,0% interrupt, 98,9% idle
CPU 49: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 50: 0,0% user, 1,8% nice, 0,0% system, 0,0% interrupt, 98,2% idle
CPU 51: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 52: 0,0% user, 0,0% nice, 0,0% system, 0,0% interrupt, 100% idle
CPU 53: 0,2% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 54: 0,2% user, 0,0% nice, 0,0% system, 0,0% interrupt, 99,8% idle
CPU 55: 0,4% user, 0,0% nice, 0,2% system, 0,0% interrupt, 99,5% idle
 
Back
Top