This weekend I got around to finally porting my Samurize config to Rainmeter. My config happened to use a Top Processes mod, so your plugin was rather useful.
However, I found a couple of bugs when working with it...
a) I couldn't get Top RAM processes and Top CPU processes working at the same time (sometimes RAM would show top CPU process, vice versa)
b) I couldn't have two different formats outputting to two different meters without them alternating between each other. (i.e. 1 measure does CPU usage with ReQuery=1, Format="%pName" and 1 measure also does CPU with ReQuery=0 and Format="%CPU")
So...at first I started writing my own plugin...and got things sort of working, but without the polish. I went back to your code with a better understanding of what was going on and fixed up a few things so that the conditions above now work perfect
What I did
Firstly, I made it so each time ReQuery is run it does both CPU and MEM sorting, regardless of MetricType. This means you can have one ReQuery=1 measure doing all the hard work and all the other measures just reading from the sorted lists.
Secondly, previously, you cached values in a dictionary as <MetricType, string>. If you have two measures going for CPU, but with different format this was a problem as there would be a race condition and you may get the output from a different measure. So instead, the cached values are now <Instance, string> so that each measures cached values are unique.
Thirdly, I put locking on the process list. I don't actually know if this helps, but I'd assume that this way each time a measure does its thing, it can do it without worrying about a ReQuery=1 measure modifying the process list part way through.
What needs fixing
I made queryString static. This basically means you can't have separate ignored processes for CPU and RAM measures. Since the process lists are static, the only real way of fixing this is to instead filter processes when looping through the output. This way you could you could have measures with different "IgnoredProcesses".
What Can You Do Now?
Well, what some requested here: have both Top CPU list and Top MEM list.
But also you can do something like shown in the attachment....where the left red box is Format="%pName", left-aligned and the right red box is Format="%CPU", right-aligned. Basically, easier and prettier alignment
Code: Select all
Source and Binaries (x64/x86): http://digitaldj.net/rainmeter/TopProcesses_v0.033.zip
You do not have the required permissions to view the files attached to this post.