How to get the CPU Usage in C?
问题 I want to get the overall total CPU usage for an application in C, the total CPU usage like we get in the TaskManager... I want to know ... for windows and linux :: current Total CPU utilization by all processes ..... as we see in the task manager. 回答1: This is platform-specific: In Windows, you can use the GetProcessTimes() function. In Linux, you can actually just use clock() . These can be used to measure the amount of CPU time taken between two time intervals. EDIT : To get the CPU