It is currently March 29th, 2024, 10:38 am

how to get page file usage

Get help with creating, editing & fixing problems with skins
Ragingwasabi
Posts: 86
Joined: March 7th, 2015, 2:23 pm

how to get page file usage

Post by Ragingwasabi »

Im trying to make a skin that shows the top 5 processes in the page file. however, im not sure which counters to use.

would it be

page size = Private bytes - Working set private

or is there a single counter that will give the data without needing me to do further calculations?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: how to get page file usage

Post by jsmorley »

From this page:
https://social.msdn.microsoft.com/Forums/en-US/2bff62a0-a3b1-487b-bae3-fa0b09124ae1/which-applications-using-page-file-and-how-much?forum=wptk_v4
There's no easy way to tell how much of a process has actually been paged out to the pagefile (i.e. actually stored in the pagefile thus using it). I am not aware of a tool that reports this information per process.

What is easily available are two PerfMon counters per process called: "Page File Bytes" and "Page File Bytes Peak". The former is also available as "Commit Size" column in task manager. These values represent the amount of memory the process has committed, which is charged against a global commit limit. The commit limit is physical memory size + pagefile size. So as the process commits memory, commit space is reserved for that process out of the total commit limit, which can come from the pagefile or physical memory.

The committed number can be very misleading because a process can commit a lot of memory but not actually touch any of it, in which case he's not consuming any physical memory or pagefile space. So we don't recommend using this metric for performance analysis.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: how to get page file usage

Post by jsmorley »

Finding out how much page in total / used / free there is in the system is not hard:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasurePhysMemTotal]
Measure=PhysicalMemory
Total=1
UpdateDivider=-1

[MeasurePhysMemUsed]
Measure=PhysicalMemory
UpdateDivider=2

[MeasurePhysMemFree]
Measure=PhysicalMemory
InvertMeasure=1
UpdateDivider=2

[MeasureSwapMemTotal]
Measure=SwapMemory
Total=1
UpdateDivider=2

[MeasureSwapMemUsed]
Measure=SwapMemory
UpdateDivider=2

[MeasureSwapMemFree]
Measure=SwapMemory
InvertMeasure=1
UpdateDivider=2

[MeasurePageTotal]
Measure=Calc
Formula=MeasureSwapMemTotal - MeasurePhysMemTotal
UpdateDivider=2

[MeasurePageUsedPercent]
Measure=Plugin
Plugin=UsageMonitor
Category=Paging File
Counter=% Usage
UpdateDivider=2

[MeasurePageUsed]
Measure=Calc
Formula=MeasurePageTotal * (MeasurePageUsedPercent / 100)
UpdateDivider=2

[MeasurePageFree]
Measure=Calc
Formula=MeasurePageTotal - MeasurePageUsed
UpdateDivider=2

[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
2.jpg
1.jpg

"By process" is a different issue, and from what I gather, not terribly reliable.
You do not have the required permissions to view the files attached to this post.
Ragingwasabi
Posts: 86
Joined: March 7th, 2015, 2:23 pm

Re: how to get page file usage

Post by Ragingwasabi »

ah dam, well at least we can it for RAM which is more important. thanks again
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: how to get page file usage

Post by rxtd »

Ragingwasabi wrote: November 1st, 2018, 2:51 pm at least we can it for RAM
I would note that you can only get "working set" and "private working set". There is no such thing as "process RAM usage" because memory is shared across processes.
Private working set is somehow reliable in the sense that at least "Private working set" bytes of RAM is used but it can show really small values.
Working set means nothing for RAM usage. You can have 100 processes with working set 1 GiB for each but they will only take 1 GiB summary because their memory is shared.
I believe that memory compression can also affect RAM usage while working set does not change.

If a process does not use any shared memory then for this process "working set" = "private working set", and RAM usage is roughly the same as working set. But it's unlikely that you ever see such a process.

As far as I know, there is no way to get real RAM usage if you are speaking of more then one single process. If you will show top 5 processes it's very likely that some of them will have significant amount of memory shared.
Last edited by rxtd on November 2nd, 2018, 10:07 am, edited 1 time in total.
Ragingwasabi
Posts: 86
Joined: March 7th, 2015, 2:23 pm

Re: how to get page file usage

Post by Ragingwasabi »

yea ive been using private working set for my skin. i read some where that task manager uses private working set. its weird it still doesnt match exactly for some processes but its mostly close enough
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: how to get page file usage

Post by Yincognito »

jsmorley wrote: November 1st, 2018, 2:29 pm Finding out how much page in total / used / free there is in the system is not hard. "By process" is a different issue, and from what I gather, not terribly reliable.
Well, it isn't hard now, with UsageMonitor - but it was a nightmare before, if you were only using Rainmeter's "built-in" memory measures to try to find pagefile(s) usage. Even now, if we talk about reliability, it's not much better, irrespective if we talk about totals or "by process": just do the math using the values from your tooltip screenshot and you'll see what I mean. Unless you have multiple pagefiles or some other odd scenario, the equalities Swap Memory = RAM + Pagefile for the total, used and free memory values are never met. For example, Swap Total <> Physical Total + Page Total, Swap Used is far from Physical Used + Page Used, and Swap Free is curiously less than Physical Free + Page Free.

It probably isn't Rainmeter's fault, but I'm just saying ... the math doesn't add up in that screenshot. The results are different from what they 'should' be by values ranging from 0.1 to 1.5 and 1.7 GB. EDIT: Just used the same approach in my case, and so far, the math is spot on. I'm not sure why it isn't in your case though.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth