How to get CPU usage and RAM usage without exec?

前端 未结 5 2116
日久生厌
日久生厌 2020-11-28 05:19

How does VBulletin get the system information without the use of exec? Is there any other information I can get about the server without exec? I am interested i

5条回答
  •  广开言路
    2020-11-28 05:45

    execquery("SELECT LoadPercentage FROM Win32_Processor");  
            $cpu_num = 0;
            $load_total = 0;
            foreach($server as $cpu)
            {
                $cpu_num++;
                $load_total += $cpu->loadpercentage;
            }
    
            $load[]= round($load_total/$cpu_num);
    
        } 
        else
        {
            $load = sys_getloadavg();
        }
        return $load;
    }
    echo implode(' ',get_server_load());
    

提交回复
热议问题