Quick and dirty way to profile your code

后端 未结 7 531
轮回少年
轮回少年 2020-12-04 18:25

What method do you use when you want to get performance data about specific code paths?

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 18:58

    Well, I have two code snippets. In pseudocode they are looking like (it's a simplified version, I'm using QueryPerformanceFrequency actually):

    First snippet:

    Timer timer = new Timer
    timer.Start
    

    Second snippet:

    timer.Stop
    show elapsed time
    

    A bit of hot-keys kung fu, and I can say how much time this piece of code stole from my CPU.

提交回复
热议问题