Windowsで実行中/アイドル状態のプロセスのCPU使用率をプログラムで(任意の言語で)知ることは可能ですか?
2 に答える
2
で次のC#
ことができます:
private PerformanceCounter cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
cpuCounter.NextValue(); // it will give you cpu usage
詳細については、こちらを参照してください。
于 2012-10-01T11:20:18.233 に答える
2
古い Windows バージョン (Windows XP SP1 より前) のサポートを気にしない場合は、GetSystemTimes Win32 API 関数を使用できます。
それ以外の場合は、 Performance Countersを使用する必要があります。
于 2012-10-01T11:23:17.877 に答える