penfold2007 Posted August 28, 2007 Report Share Posted August 28, 2007 Hi there, Powergadgets appears to be very cool! I'm still evaluating it just now, and am trying to add multiple values to a gauge. I would like to monitor working set size and min/max working set limits. Ideally this would have the working set size as a vertical gauge, and the limits as little pointers on the gauge. I can get the working set size using: Get-wmiobject -class "Win32_PerfRawData_PerfProc_Process" | where {$_.Name -eq "_Total"} | out-gauge -value WorkingSet -floating -refresh 0:0:1 However, I am not a coder, so am unsure how to use the SetProcessWorkingSetSizeEx API to return the min/max limits in a powershell script, or how to incorporate this into the same gadget. Any help would be appreciated. Thanks, Dan. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 28, 2007 Report Share Posted August 28, 2007 OK, so what you're wanting is: 1. A needle to tell you the current value. 2. Some smaller indicators of the current minimum and maximum values that WorkingSet has reached. The values will change/reset if the current min or max is passed to their new values. I would think it would be easier to manage this within a PSH script, and pass the values off to out-gauge after. That will require creating some custom objects. Do I have #1 and #2 right above? From there, I can write something up hopefully today. Quote Link to comment Share on other sites More sharing options...
penfold2007 Posted August 28, 2007 Author Report Share Posted August 28, 2007 Hi, that's half-correct. I am after the current value of the process working set size. However, Windows also offers the ability to set min/max limits on working sets, using the SetProcessWorkingSetSize (2000 and XP) or SetProcessWorkingSetSizeEx (only available in Server 2003 and Vista) APIs. This actively affects how the memory manager behaves when paging processes in/out of physical memory. For example, if you use the Ex version of the API to implement a max limit of 10MB on a process, an instance of that process attempting to use a working set of 15MB would result in the least-recently-used 5MB being written to pagefile. (the non-Ex API behaves slightly differently, although is essentially the same thing) I would like the smaller indicators to return the values of these limits. If it's too much hassle to get into the API calls, then tips for how to incorporate multiple perfmon counters into a single gadget via powershell would be just as welcome. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 28, 2007 Report Share Posted August 28, 2007 Let me do some research on GetProcessWorkingSetSize/GetProcessWorkingSetSizeEx. I like to think there's always a way, especially with PowerShell... It is pretty easy to incorporate several values into a signle gadget. What would you like to see? One main needle for the current total, then smaller inline needles/gauges representing other data? Quote Link to comment Share on other sites More sharing options...
penfold2007 Posted August 28, 2007 Author Report Share Posted August 28, 2007 To start with, having the following objects from the Win32_PerfRawData_PerfOS_Memory class on a single display would be really useful: AvailableMBytes ModifiedPageListBytes StandbyCacheCoreBytes StandbyCacheNormalPriorityBytes I realise this is probably real easy but I don't see it in the docs. (If it is in the documentation, point it out and I will stumble away with my head down in shame!) Thanks. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 28, 2007 Report Share Posted August 28, 2007 Sorry, where do these come from: ModifiedPageListBytes, StandbyCacheCoreBytes, StandbyCacheNormalPriorityBytes? I don't see them in Win32_PerfRawData_PerfOS_Memory on XP. Which one do you want in the main gauge? I'm assuming you'd like to see the other values as "inner gauges"? Quote Link to comment Share on other sites More sharing options...
penfold2007 Posted August 28, 2007 Author Report Share Posted August 28, 2007 Sorry - they are only exposed in Vista/Longhorn. Just pick any others to be honest, so I can just see the principle. Available MBytes as the main series, although I may present this as line graphs or something. Inner gauges will be fine for now. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 28, 2007 Report Share Posted August 28, 2007 Here, put this all on *one line* though (precede each new line below with a single space when you combine it all): get-wmiobject Win32_PerfRawData_PerfOS_Memory|out-gauge -mainvalue {$_.availablembytes} -InnerGauges_Add radial -InnerGauges_0_radialgauge_Value {$_.pagereadspersec} -InnerGauges_0_Layout_Target AnchorPoint -InnerGauges_0_Layout_AnchorPoint"-0.4,-0.4" -InnerGauges_Add radial -InnerGauges_1_radialgauge_Value {$_.writecopiespersec} -InnerGauges_1_Layout_Target AnchorPoint -InnerGauges_1_Layout_AnchorPoint "0.4,-0.4" [Edit: Mention that one needs to add a space to each line, e.g. from above is "-InnerGauges_Add[space]radial"] Quote Link to comment Share on other sites More sharing options...
penfold2007 Posted August 29, 2007 Author Report Share Posted August 29, 2007 Aah, now I see (FYI for anyone else trying this, there is an extra space needed after the first AnchorPoint). It seems a shame that the syntax for different gadget types does not appear to be entirely consistent though - have you any tips for quickly converting to other types? Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 29, 2007 Report Share Posted August 29, 2007 I'll try to blog about it, but it could be a few weeks. I've thought of a "wrapper" script that could interactively ask the user some questions and build the gauge that way, based on the answers provided. Explaning how to create these extra gauges through the Creator would be too time consuming to cover in detail. It did help me find the proper parameters though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.