Getting device cpu usage and free ram on WinCE in C #

I am looking for alternative ways to get total CPU percentage and free RAM on a device in C #.

There is an extremely simple solution described here: http://zamov.online.fr/EXHTML/CSharp/CSharp_927308.html

However, the PerformanceCounter class is not included in the .NET Compact Framework 3.5.

Are there other ways?

Thank:)

+2


source to share


2 answers


Free RAM is pretty straightforward - although you have both physical and virtual to deal with - and both are important. You P / Invoke GlobalMemoryStatus for this (as usual, SDF is already hooked into a friendlier object model).



CPU utilization is a very different animal. On a PC, you have a good processor register which gives you easy and cheap access to CPU usage. On ARM (which is what your WinMo device is) you don't have that. It can be calculated using a combination of API Toolhelp and GetThreadTimes

, but it is very heavy and the process of calculating it uses a lot of CPU on its own. Generally speaking, the CPU usage isn't worth the cost of the code or the execution time it takes to get it.

+3


source


You need to summarize the process time of a process for processes and then you will get a list of processes and their start times over a period of time: http://www.hjgode.de/wp/2012/12/14/mobile-development-a-remote- cpu-monitor-and-cpu-usage-analysis /



0


source







All Articles