accessing cpu information from linux kernel module -


i need access cpu idle time every 1 minute linux kernel module , print kern.log can plot graph statistics. please help.

thanks in advance.

you don't need write kernel module that, information provided in /proc/stat:

$ awk ' /^cpu/ { print $1, $5 / 100; } ' /proc/stat cpu 251908 cpu0 63149.6  <--- total idle time in seconds  cpu1 62053.2 ... 

where 100 user_hz constant (100 on systems).

if still wish write kernel module, can re-use /proc/stat code here: fs/proc/stat.c.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -