CPU使用率无法测量?
我正在尝试监视一个进程的 CPU 使用情况,我一直在更新该进程以完成更多工作。然而,读取 /proc/pid/stat 文件时,进程的 jiffie 计数(utime、stime 等)不会增加。 (它肯定在做一些工作,我可以用 strace 等看到它)。
该进程正在执行的工作量相对较小(每秒读取 /proc/stat 10 次、执行 scanf、一些添加/删除操作以及更新一些共享内存)。是否有可能工作量如此之低以至于无法增加 jiffie 计数?进程是否必须占用处理器一个完整的 jiffie 才能增加计数?
任何想法将不胜感激
干杯 乔.
Im trying to monitor the CPU usage of a process I've been updating to do a bit more work. However reading the /proc/pid/stat file, the jiffie counts (of utime,stime, etc) of the process will not increase. (It is definately doing some work, I can see it with strace etc).
The amount of work the process is doing is relatively tiny (reads /proc/stat 10 times per second, does a scanf, a few add/deletes, and updates some shared memory). Is it possible that an amount of work can be so low that it does not manage to increment the jiffie count? Does a process have to hold onto the processor for a complete jiffie in order to increment the count?
Any thoughts would be most appreciated
Cheers
Joe.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在查看的计数器会在计时器滴答期间更新。仅更新发生蜱时运行的进程。如果您的进程进行了大量等待,那么当计时器触发时它很可能不会运行。
The counters you are looking at are updated during a timer tick. Only the process running when the tick occurs is updated. If your process does a lot of waiting, then chances are it won't be running when the timer fires.