How to restrict the CPU usage a C# program takes?

后端 未结 3 2114
悲哀的现实
悲哀的现实 2020-12-17 17:54

I am developing a C# program, and i have one function that consumes too much CPU. I would like to know a way to control this by code (not with any external application) and

3条回答
  •  忘掉有多难
    2020-12-17 18:41

    I guess you need to query some kind of OS API to find out how much of the CPU are you consuming and take throttling decisions (like Thread.Sleep) from that on.

提交回复
热议问题