zzyphp111
V2EX  ›  macOS

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

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

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