Linux Module to print number of CPU's
We can look at /proc/cpuinfo to find out the number of processors present in Linux from user space.
What if we want to find out the number of cpus in kernel module. num_online_cpus() function can give the number of CPU's which are online.
Code:
Output:
References:
https://stackoverflow.com/questions/43171805/find-number-of-cpus-in-linux-kernel
What if we want to find out the number of cpus in kernel module. num_online_cpus() function can give the number of CPU's which are online.
Code:
Output:
References:
https://stackoverflow.com/questions/43171805/find-number-of-cpus-in-linux-kernel
Comments
Post a Comment