• Yunhui Cui's avatar
    sock: add tracepoint for send recv length · 6e6eda44
    Yunhui Cui authored
    Add 2 tracepoints to monitor the tcp/udp traffic
    of per process and per cgroup.
    
    Regarding monitoring the tcp/udp traffic of each process, there are two
    existing solutions, the first one is https://www.atoptool.nl/netatop.php.
    The second is via kprobe/kretprobe.
    
    Netatop solution is implemented by registering the hook function at the
    hook point provided by the netfilter framework.
    
    These hook functions may be in the soft interrupt context and cannot
    directly obtain the pid. Some data structures are added to bind packets
    and processes. For example, struct taskinfobucket, struct taskinfo ...
    
    Every time the process sends and receives packets it needs multiple
    hashmaps,resulting in low performance and it has the problem fo inaccurate
    tcp/udp traffic statistics(for example: multiple threads share sockets).
    
    We can obtain the information with kretprobe, but as we know, kprobe gets
    the result by trappig in an exception, which loses performance compared
    to tracepoint.
    
    W...
    6e6eda44
sock.h 7.74 KB