How we can reduce the resolution of myProcess.TotalProcessorTime?

后端 未结 1 509
一向
一向 2020-12-21 17:09

I\'m using TotalProcessorTime to mesure time speding by a method in cpu.

for(int i=0;i<10;i++){
    double s = Process.getCurrentProcess().TotalProcessorT         


        
相关标签:
1条回答
  • 2020-12-21 17:29

    I am almost certain you would want to use Stopwatch, QueryPerformanceCounter, or alike for what you desire. However, the granularity of TotalProcessorTime can be modified:

    The granularity/resolution is determined by the systems timer resolution. This Accurate Windows timer?... answer shows how to obtain and how to modify the systems timer resolution. Coding examples are given here (c) and here (c#).

    0 讨论(0)
提交回复
热议问题