Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 39
    +1 I hate when all people can say is "Don't do that". There may be reasons beyond what people understand of a problem, and yet they treat the asker as if he's just new to this stuff and doesn't know anything. By the way Your code in C# is what I've been looking for and yes, I am developing a background service - according to other answers I should kill the users' CPUs with it. Commented Jul 14, 2015 at 7:56
  • 4
    @PrzemysławWrzesiński you are right 100%. I have come across a network appliance situation where it logs streams AT SCALE and a periodic process for extracting portions is not allowed to take more than 10% of the CPU, ever, because the primary function is to capture the massive streams and the CPU is being taxed and hardware engineering can't do anymore than they are doing. So this is a very valid question. Commented Jul 24, 2015 at 23:29
  • 6
    " it still annoys me that the accepted answer criticizes the question rather than answering it" --- I think likewise. People should answer rather than asking why the hell someone asked it. By the way I have a very similar app that makes cpu shoot 95% and i want it to run longer but must not spike CPU to 95% every time. Commented Oct 25, 2015 at 10:56
  • 1
    It seems that this approach is problematic. It seems that a Stopwatch object measures the elapsed time, not only the time that is consumed by the current thread. Commented Mar 12, 2017 at 10:56
  • 1
    Anyway, until we have better ways to signal preferences to CPU frequency governors, frequent artificial sleeps are probably a good idea. This also works on Linux to keep the frequency low: Why does this delay-loop start to run faster after several iterations with no sleep? Commented May 8, 2018 at 7:26