What are the common causes for high CPU usage?

前端 未结 8 676
半阙折子戏
半阙折子戏 2020-12-13 08:19

Background:

In my application written in C++, I have created 3 threads:

  • AnalysisThread (or Producer) : it reads an input file, parses
8条回答
  •  萌比男神i
    2020-12-13 08:39

    Threads consume resources such as memory. A blocking/unblocking thread incurs a once off cost. If a thread blocking/unblocks tens of thousands of times per second this can waste significant amounts of CPU.

    However once a thread is blocked, it doesn't matter how long it is blocked for, there is no ongoing cost. The popular way to find performance problems is to use profilers.

    However, I do this a lot, and my method is this: http://www.wikihow.com/Optimize-Your-Program%27s-Performance

提交回复
热议问题