Can a C# program measure its own CPU usage somehow?

后端 未结 5 956
名媛妹妹
名媛妹妹 2020-12-12 18:54

I am working on a background program that will be running for a long time, and I have a external logging program (SmartInspect) that I want to feed with some values periodic

5条回答
  •  长情又很酷
    2020-12-12 19:26

    You can also use System.Diagnostics.Process.TotalProcessorTime and System.Diagnostics.ProcessThread.TotalProcessorTime properties to calculate your processor usage as this article describes.

提交回复
热议问题