[PATCH] top '-c' switch to enable output of SMP cpu lines.

David Laight David.Laight at ACULAB.COM
Wed Jan 26 12:12:59 UTC 2022


From: Jonathan Sambrook
> Sent: 25 January 2022 17:44
> 
> This allows access to SMP cpu lines for batch output, as well as
> displaying SMP info in interactive mode without having to press '1'.
> 
> My motivation here is to be able to access the SMP information when
> graphing BusyBox top batch output with topplot
..
> +//usage:	IF_FEATURE_TOP_SMP_CPU(
> +//usage:   "\n""	-c	Same as '1' key"
> +//usage:	)

Better to just say 'One line for each cpu'.

...
> +#if ENABLE_FEATURE_TOP_SMP_CPU
> +	if (col & OPT_c) {
> +		cpu_jif = cpu_prev_jif = NULL;
> +        num_cpus = 0;

Whitespace manged...

> +		smp_cpu_info = !smp_cpu_info;
> +		get_jiffy_counts();
> +	}
> +#endif

Is this block needed - I suspect the main loop can be made to DTRT.

You also probably want the 'IRIX mode' patches I posted a few months back.
Otherwise on a system with a lot of cpu the per-process cpu time is
always very small.

They may have got lost....

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)



More information about the busybox mailing list