printk function is used to debug query

Previous sections described the printk is any work and how to use it. Did not say that it's drawbacks.

 

Extensive use of printk can significantly slow down the system, even if you reduce cosole_loglevel to avoid loading the console device, because syslogd will continue to synchronize its output files; therefore, each row to be printed causes a disk operations from the perspective of syslogd. that's right it tries to achieve everything written to disk, to prevent system crashes just after printing the message; however, you do not want just to the debug information and slow down your system can appear in / etc / syslogd. .conf in your log file name with a hyphen before to solve this problem [ 14 ] 14 . change the problems caused by the configuration file, this change might remain there after the end of your debugger, you even during normal system operation really want to refresh the messages to disk as soon as possible. another option is to run such a permanent change in non-klogd program (eg cat / proc / kmsg, as previously suggested), but this may not provide a suitable environment for normal system operation .

 

Often, the best way to get information is to query the system, when you need information, not continuously generate data in fact, every Unix system provides many tools to get the system message:. Ps, netstat, vmstat, etc. .

 

There are several techniques to drive developers to query the system: create a file in the / proc file system, using the ioctl driver method, with the use sysfs sysfs output attribute needs a lot of background information on the drive model. 

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11141517.html