zzyphp111
V2EX  ›  macOS

mac 如何实时感知流量消耗对应进程排行

  •  
  •   zzyphp111 · Aug 19, 2021 · 2858 views
    This topic created in 1753 days ago, the information mentioned may be changed or developed.

    背景

    有个网速监控软件,是不是就下载上传 10M/s 感觉很奇怪,什么都没做,打开资源管理器,也看不到什么耗费 cpu 和资源的进程,完全无感知,要不是有网速监控器。

    暂时的解决方案

    目前我是东拼西凑,看到的对应进程,但是很不方便....

    * 各个进程流量
    sudo nethogs
    
    * 打印所有请求 tcp 记录
    sudo tcpdump -i en0 -n  port 80 -vv
    
    * 根据命令名以及参数找到 PID
    pgrep -a php
    

    期望

    通过命令行也行,或者软件也行,只要能让我看到 监控结果就好,我要知道到底问题出在哪里。

    7 replies    2021-08-21 22:26:28 +08:00
    dcty
        1
    dcty  
       Aug 19, 2021
    装个 surge,开启增强模式
    102errors
        2
    102errors  
       Aug 19, 2021
    软件可以试试 iStat Menus 之类的
    开发的话可以试试用 getifaddrs 取 ifi_obytes 和 ifi_ibytes
    命令行相关的没用过,等楼下回答吧
    wellsc
        3
    wellsc  
       Aug 19, 2021
    clashx ;istatus
    pseudo
        4
    pseudo  
       Aug 21, 2021
    可以试试我写的 https://github.com/gao-sun/eul
    GoodRui
        5
    GoodRui  
       Aug 21, 2021   ❤️ 1
    @pseudo 大佬牛逼啊,6k 星星了~
    zzyphp111
        6
    zzyphp111  
    OP
       Aug 21, 2021
    @pseudo #4 好的,谢谢
    silverzhao
        7
    silverzhao  
       Aug 21, 2021   ❤️ 1
    macOS 自带命令:

    $ nettop -m tcp -d -c -P -J bytes_in,bytes_out
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   941 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 18:50 · PVG 02:50 · LAX 11:50 · JFK 14:50
    ♥ Do have faith in what you're doing.