摘要 |
A CPU occupation rate detection method and apparatus. The CPU occupation rate detection method comprises: acquiring a first execution duration and a first interrupt duration of a pre-set task at a CPU within a current detection period (S10); when the first execution duration and the first interrupt duration are acquired, using a difference between the first execution duration and the first interrupt duration as a first actual execution duration of the pre-set task at the CPU within the current detection period (S20); and acquiring a second actual execution duration of the pre-set task at the CPU within a previous detection period, and calculating an execution occupation rate of the pre-set task at the CPU based on the first actual execution duration, the second actual execution duration and the detection period (S30). The method and apparatus can improve the accuracy of CPU occupation rate detection. |