Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
HTOP如何收集每个进程和整个系统的CPU消耗、内存消耗等信息?我不熟悉 linux 为收集这些统计信息而提供的任何操作系统特定的 api(如套接字 api)。
好吧,我先给你指出htop来源。
htop
然后,像 Linux 这样的操作系统有很多接口来获取这些信息。其中一些指标可通过经典的/proc伪文件系统或通过/sys/; 其他的可能只能通过ioctls 或特定的系统调用(例如getgid)获得。
/proc
/sys/
ioctl
getgid