Getting the device's CPU utilization and free RAM on WinCE in C#

前端 未结 2 359
梦谈多话
梦谈多话 2021-01-22 21:16

I\'m looking for alternative ways of obtaining the total CPU utilization percentage and the amount of free RAM on the device in C#.

There is an extremely easy solution d

相关标签:
2条回答
  • 2021-01-22 21:57

    Free RAM is fairly easy - though you have both Physical and Virtual to contend with - and both are important. You P/Invoke GlobalMemoryStatus for that (as usual the SDF has it already wrapped in a more friendly object model as well).

    CPU usage is a different animal altogether. On the PC you have a nice processor register that gives you easy, cheap access to the CPU usage. On ARM (which is what's in your WinMo device) you don't have that. It can be calculated using a mix of the Toolhelp APIs and GetThreadTimes, but it's very heavy handed and the process of calculating it uses a lot of CPU all by itself. Generally speaking getting CPU usage isn't worth the expense of the code or the execution time required to get it.

    0 讨论(0)
  • 2021-01-22 22:08

    You need to sum thread process times for processes and then you get a list of processes and the time they run within a time period: http://www.hjgode.de/wp/2012/12/14/mobile-development-a-remote-cpu-monitor-and-cpu-usage-analysis/

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