How to display percentage of CPU load info set by stress-ng utility at specific interval into terminal?
Solution 1:
Depending on your processor make and model, you might be able to use turbostat (linux-tools-common package) to get what you want. It works with most recent Intel processors and, if your version of turbostat is new enough, many AMD processors.
Example, where I have a 12 instances of a program running at 80% utilization at a work/sleep frequency of 273 hertz on a 6 core 12 CPU Intel 10600K processor, and I am sampling at 6 seconds per sample:
$ sudo turbostat --quiet --show Core,CPU,Busy%,Bzy_MHz,IRQ,PkgWatt,PkgTmp --interval 6
Core CPU Busy% Bzy_MHz IRQ PkgTmp PkgWatt
- - 78.55 4800 90958 67 85.25
0 0 78.53 4800 7598 67 85.25
0 6 78.55 4800 7579
1 1 78.55 4800 7570
1 7 78.56 4800 7568
2 2 78.55 4800 7594
2 8 78.56 4800 7575
3 3 78.54 4800 7570
3 9 78.56 4800 7574
4 4 78.55 4800 7569
4 10 78.57 4800 7564
5 5 78.54 4800 7563
5 11 78.55 4800 7634
Core CPU Busy% Bzy_MHz IRQ PkgTmp PkgWatt
- - 78.54 4800 90801 67 85.27
0 0 78.55 4800 7567 67 85.27
0 6 78.54 4800 7575
1 1 78.55 4800 7562
1 7 78.55 4800 7576
2 2 78.54 4800 7563
2 8 78.54 4800 7569
3 3 78.54 4800 7563
3 9 78.54 4800 7563
4 4 78.54 4800 7564
4 10 78.55 4800 7571
5 5 78.55 4800 7562
5 11 78.54 4800 7566
Core CPU Busy% Bzy_MHz IRQ PkgTmp PkgWatt
- - 78.53 4800 90805 68 85.00
0 0 78.51 4800 7567 68 85.00
0 6 78.56 4800 7574
1 1 78.57 4800 7565
1 7 78.43 4800 7571
2 2 78.45 4800 7565
2 8 78.58 4800 7570
3 3 78.55 4800 7564
3 9 78.53 4800 7566
4 4 78.54 4800 7564
4 10 78.54 4800 7570
5 5 78.54 4800 7561
5 11 78.55 4800 7568
Core CPU Busy% Bzy_MHz IRQ PkgTmp PkgWatt
- - 78.50 4800 90765 68 84.39
0 0 78.34 4800 7569 68 84.39
0 6 78.58 4800 7573
1 1 78.59 4800 7560
1 7 78.36 4800 7570
2 2 78.52 4800 7563
2 8 78.55 4800 7567
3 3 78.30 4800 7535
3 9 78.58 4800 7566
4 4 78.54 4800 7561
4 10 78.55 4800 7569
5 5 78.55 4800 7564
5 11 78.54 4800 7568