Jump to content
Software FX Community

Newbie question


Recommended Posts

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.






Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.


Link to comment
Share on other sites

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?

Link to comment
Share on other sites

To start with, having the following objects from the Win32_PerfRawData_PerfOS_Memory class on a single display would be really useful:





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!)



Link to comment
Share on other sites

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"]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...