Some time ago, I posted my remote CPU usage monitor. Now here is a similar tool but for logging the memory.
There are two tools: vmUsage and vmUsageRecvr. You may use the mobile vmUsage alone and just use its logging. The other tool receives the memory status information on a PC and enables long time logging and export to a CSV text.
vmUsage is the mobile application that shows you a list of bars, one bar for each of the 32 possible process slots. It also shows the process name running in a slot and the memory usage. The memory usage is queried using a KernelIOCtl
(IOCTL_KLIB_GETPROCMEMINFO
). I found that API call at CodeProject. I first tried with the approach made in VirtualMemory at CodeProject. But using VirtualQuery for every 4K block inside 32 pieces of 32MB takes a lot of time (256000 blocks!). The following shows a process memEater
that is gaining more and more memory:
You can also see the total physical and available memory in the first bar and you will recognize irregular memory changes too.
The small tool sends all data using UDP to possible receivers. My receiver is called vmUsageRecvr
and receives the data and saves every virtual memory status received to a SQLite database. The data can then be exported and is re-arranged by known processes. The live view of vmUsageRecvr
shows the latest receive memory status and a small line graphic showing how the used memory changed over time.
You can use the exported data in Excel and again produce nice graphics.
In the above graph, you can see memeater is consuming memory in 1MB steps until it crashes. The other memory peek is produced by pimg.exe, the camera dialog, when I made a photo.
Processes may start and go and so their process ID will be zero when they are not running. If a process is gone, vmUsage will not record it in its log:
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 15175680
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 323395584
vtotal 33554432tvfree 26476544 load 35
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 16228352
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 322342912
vtotal 33554432tvfree 26476544 load 35
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 17281024
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 322342912
vtotal 33554432tvfree 26476544 load 35
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 17281024
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 321282048
vtotal 33554432tvfree 26476544 load 35
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 18337792
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 320163840
vtotal 33554432tvfree 26476544 load 36
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 19456000
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 320163840
vtotal 33554432tvfree 26476544 load 36
20130221 06:17 pimg 569344 VMusage.exe 2105344 MemEater.exe 19456000
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 319111168
vtotal 33554432tvfree 26476544 load 36
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 20508672
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 318054400
vtotal 33554432tvfree 26476544 load 36
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 21561344
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 317001728
vtotal 33554432tvfree 26476544 load 36
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 22614016
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 317001728
vtotal 33554432tvfree 26476544 load 36
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 22614016
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 315949056
vtotal 33554432tvfree 26476544 load 37
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 23666688
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 314896384
vtotal 33554432tvfree 26476544 load 37
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 24719360
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 314896384
vtotal 33554432tvfree 26476544 load 37
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 24719360
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 313843712
vtotal 33554432tvfree 26476544 load 37
20130221 06:17 pimg 569344 VMusage.exe 2109440 MemEater.exe 25772032
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 314822656
vtotal 33554432tvfree 27459584 load 37
20130221 06:18 pimg 569344 VMusage.exe 1191936 MemEater.exe 25772032
tmail.exe 303104 IQueue.exe 679936 total 493723648 free 340561920
vtotal 33554432tvfree 27328512 load 32
20130221 06:18 pimg 569344 VMusage.exe 1323008 tmail.exe 303104
IQueue.exe 679936 total 493723648 free 340430848
vtotal 33554432tvfree 27197440 load 32
20130221 06:18 pimg 569344 VMusage.exe 1388544 tmail.exe 303104
IQueue.exe 679936 total 493723648 free 340365312
vtotal 33554432tvfree 27131904 load 32
20130221 06:18 pimg 569344 VMusage.exe 1519616 tmail.exe 303104
IQueue.exe 679936 total 493723648 free 340234240
vtotal 33554432tvfree 27000832 load 32
When a process is gone in vmUsageRecr
, the process data is still there. In the following export viewed in Excel, you can see pimg is first not running. After pimg is started, it consumes about 368KB. Then, I took a photo and the memory increased to 1.1MB:
Leave me a comment if you have any questions.
The source code can be loaded from github.