How to get the number of CPU cycles used by a process

后端 未结 3 955
离开以前
离开以前 2021-02-02 18:19

I have a need to get the number of CPU cycles used by a specific process using C# (or VB.Net). This information is available in the Process properties popup within Sysinternal\

3条回答
  •  青春惊慌失措
    2021-02-02 18:43

    Process Explorer calls QueryProcessCycleTime to get that information. You will probably have to use P/Invoke to call it. I would expect its P/Invoke signature to look like:

    [DllImport("kernel32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool QueryProcessCycleTime(IntPtr ProcessHandle, out ulong CycleTime);
    

提交回复
热议问题