5.91 BCC工具之tcpcong.py解读

一,工具简介

tcpcong工具跟踪Linux内核的TCP拥塞控制状态的变化事件,然后计算每个状态的持续时间并进行记录,最后以表格或直方图的形式将其打印出来,可用于评估TCP拥塞算法的性能。

TCP拥塞控制是确保网络稳定性和性能的关键机制之一,它通过动态调整发送速率来避免网络拥塞。

当TCP连接经历不同的拥塞状态(如慢启动、拥塞避免、快速重传和快速恢复)时,这些状态更改会触发相应的内核函数。我们可以利用tcpcong将这些内核函数的调用事件捕获并进行分析。

二,代码示例

#!/usr/bin/env python

from __future__ import print_function
from bcc import BPF
from time import sleep, strftime
from struct import pack
from socket import inet_ntop, AF_INET, AF_INET6
from struct import pack
import argparse

examples = """examples:
    ./tcpcong                 # show tcp congestion status duration
    ./tcpcong 1 10            # show 1 second summaries, 10 times
    ./tcpcong -L 3000-3006 1  # 1s summaries, local port 3000-3006
    ./tcpcong -R 5000-5005 1  # 1s summaries, remote port 5000-5005
    ./tcpcong -uT 1           # 1s summaries, microseconds, and timestamps
    ./tcpcong -d    

相关推荐

  1. 5.8 BCC工具mysqld_query.py解读

    2024-03-31 09:06:08       51 阅读
  2. 5.54 BCC工具dbstat.py解读

    2024-03-31 09:06:08       44 阅读
  3. 5.56 BCC工具funcslower.py解读

    2024-03-31 09:06:08       43 阅读
  4. 5.53 BCC工具dbslower.py解读

    2024-03-31 09:06:08       41 阅读
  5. 5.49 BCC工具rdmaucma.py解读

    2024-03-31 09:06:08       40 阅读
  6. 5.52 BCC工具dbslower.py解读

    2024-03-31 09:06:08       44 阅读
  7. 5.69 BCC工具runqlen.py解读

    2024-03-31 09:06:08       41 阅读
  8. 5.82 BCC工具tcpdrop.py解读

    2024-03-31 09:06:08       36 阅读
  9. 5.70 BCC工具runqslower.py解读

    2024-03-31 09:06:08       34 阅读
  10. 5.72 BCC工具wakeuptime.py解读

    2024-03-31 09:06:08       39 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-31 09:06:08       70 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-31 09:06:08       74 阅读
  3. 在Django里面运行非项目文件

    2024-03-31 09:06:08       62 阅读
  4. Python语言-面向对象

    2024-03-31 09:06:08       72 阅读

热门阅读

  1. #!/bin/sh和#!/bin/bash的区别

    2024-03-31 09:06:08       35 阅读
  2. 【使用python读取多类型文件夹中的文档内容】

    2024-03-31 09:06:08       37 阅读
  3. pytest中文使用文档----9集成文档测试

    2024-03-31 09:06:08       43 阅读
  4. Linux|如何管理多个Git身份

    2024-03-31 09:06:08       36 阅读
  5. wifi密码,pc端

    2024-03-31 09:06:08       31 阅读
  6. git commit message 规范

    2024-03-31 09:06:08       36 阅读
  7. git总结

    2024-03-31 09:06:08       35 阅读
  8. MindOpt APL向量化建模语法的介绍与应用(1)

    2024-03-31 09:06:08       36 阅读