sayhello
Posts: 37
Joined: Sat Mar 05, 2016 1:02 pm

Cpu load test linux -how busy is the cpu - test methods & tools

Thu Aug 16, 2018 10:43 pm

dear community



which methods help to get more insights into cpu load

are there some certain test methods in linux that help us to see

-how busy is the cpu
- test methods & tools and commands for commandline


look forward to hear from you



User avatar
rpdom
Posts: 12744
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Cpu load test linux -how busy is the cpu - test methods & tools

Fri Aug 17, 2018 5:06 am

The "top" command will show system usage stats. "man top" for full usage info - there is a lot of it.

User avatar
PeterO
Posts: 4237
Joined: Sun Jul 22, 2012 4:14 pm

Re: Cpu load test linux -how busy is the cpu - test methods & tools

Fri Aug 17, 2018 6:53 am

If you want to get information about CPU usage, glibtop provides an API that returns one of these:

Code: Select all

struct glibtop_cpu {
	guint64 flags;
	guint64 total;				/* GLIBTOP_CPU_TOTAL		*/
	guint64 user;				/* GLIBTOP_CPU_USER		*/
	guint64 nice;				/* GLIBTOP_CPU_NICE		*/
	guint64 sys;				/* GLIBTOP_CPU_SYS		*/
	guint64 idle;				/* GLIBTOP_CPU_IDLE		*/
	guint64 iowait;				/* GLIBTOP_CPU_IOWAIT		*/
	guint64 irq;				/* GLIBTOP_CPU_IRQ		*/
	guint64 softirq;			/* GLIBTOP_CPU_SOFTIRQ		*/
	guint64 frequency;			/* GLIBTOP_CPU_FREQUENCY */
	guint64 xcpu_total [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_TOTAL		*/
	guint64 xcpu_user [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_USER		*/
	guint64 xcpu_nice [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_NICE		*/
	guint64 xcpu_sys  [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_SYS		*/
	guint64 xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE		*/
	guint64 xcpu_iowait [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IOWAIT		*/
	guint64 xcpu_irq [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IRQ		*/
	guint64 xcpu_softirq  [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_SOFTIRQ		*/
	guint64 xcpu_flags;	                /* GLIBTOP_XCPU_IDLE		*/
};
https://developer.gnome.org/libgtop/sta ... libtop-cpu

I use it to get information for my analogue (VU meter style) CPU load meter.
Meter2.png
Analogue CPU load meter
Meter2.png (16.56 KiB) Viewed 92 times
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot] and 15 guests