简体   繁体   中英

How to add code into the linux kernel?

I am studying how to analyse and evaluate the TCP/IP protocol stack of Linux. My goal is to study the performance of the tcp/ip protocol stack as a whole, to study the time cost of each layer and interaction between the layers of tcp/p protocol and queuinf of the ip layer.

To do the above : I am using a probing node based schema to to study the internal behaviour of TCP/IP protocol of linux. probing node is a piece of code added into the kernel to record the information like timestamp, queuing length and size of packet.

my question : how to add the probing node into the kernel ?

You can use (for example) SystemTap , the main idea behind this tool is to put probing node somewhere: kernel or userspace program.

If you do not have time to learn SystemTap, you can just put some printk in the kernel and read them from dmesg .

In both cases, you are introducing a big delay in the network stack due to the prints. In order to reduce the delay introduced by probing, I suggest you to use SystemTap, store all your time-sample somewhere and print only at the end of acquisition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM