dongtong848825 2013-01-24 09:13
浏览 164

如何在Windows上以PHP的形式获取每个CPU Core的负载?

Is there a way to do so? I tried using WMI, and the Win32_PerfRawData_PerfOS_Processor class, i end up having the PercentProcessorTime and Timestamp_PerfTime which would require to sleep a while to calculate the percentage, but thats not what i need, i need something that does not require PHP to wait a couple second, it should print out the load almost instantly

  • 写回答

3条回答 默认 最新

  • doushuo8677 2013-01-24 09:22
    关注

    One way would be to have another program that continuously checks and logs the processor load somewhere where PHP would be able to read the values directly. There would probably be a slight delay in the logging but nothing like a couple of seconds.

    You could probably do that in a separate PHP script. Just make sure you sleep() for a short while between the checks, otherwise the processor reading script would push the processor to maximum load immediately.

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?