AutoHotkey Community

It is currently May 27th, 2012, 12:37 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: July 5th, 2010, 11:59 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Have you got NtQuerySystemInformation() working? (i have)

Edit: It seems that i have NtSetSystemInformation() working. I have task manager up, and when run my test script the Firefox memory usage drops a bit :?::?:

_________________
My Ahk Site


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2010, 2:25 pm 
Offline

Joined: January 21st, 2009, 1:06 pm
Posts: 63
a_h_k wrote:
Have you got NtQuerySystemInformation() working? (i have)

Edit: It seems that i have NtSetSystemInformation() working. I have task manager up, and when run my test script the Firefox memory usage drops a bit :?::?:


Negative, I havent been able to make any head way other than what mouser helped me with. Mind sharing your source? :)

If you use CacheSet from sysinternals you will be able to monitor your system file cache. The relevant section is under the "Cache Information" groupbox. If your script is working you should see the "Current Size" field drop significantly and then start filling back up.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2010, 3:43 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
To read the system info i used...
Code:
; Constant
SYSTEM_INFO_CLASS = 0x15

; Set buffer size
SystemInfoLength = 36
VarSetCapacity(SystemCacheInfo, SystemInfoLength, 0)      

; DLL call
DllCall("C:\Windows\system32\ntdll.dll\NtQuerySystemInformation",  "UInt",SYSTEM_INFO_CLASS,  "UInt",&SystemCacheInfo,  "UInt",SystemInfoLength)

; Read values
CurrentSize := NumGet(SystemCacheInfo, 0, "UInt")
PeakSize := NumGet(SystemCacheInfo, 4, "UInt")
PageFaultCount := NumGet(SystemCacheInfo, 8, "UInt")
MinimumWorkingSet := NumGet(SystemCacheInfo, 12, "UInt")
MaximumWorkingSet := NumGet(SystemCacheInfo, 16, "UInt")
TransitionSharedPages := NumGet(SystemCacheInfo, 20, "UInt")
PeakTransitionSharedPages := NumGet(SystemCacheInfo, 24, "UInt")
:)

As for writing...
Did the test with CacheSet .. and no unfortunately it did not act like the "Clear" button (what i saw before must have been just a random drop in memory) :(

_________________
My Ahk Site


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2010, 6:00 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
After a bit of "detective work" i worked out that some "bit-shifting" was required (to give the correct values - as displayed in CacheSet)...
Code:
; Constant
SYSTEM_INFO_CLASS = 0x15

; Set buffer size
SystemInfoLength = 36
VarSetCapacity(SystemCacheInfo, SystemInfoLength, 0)      

; DLL call
DllCall("C:\Windows\system32\ntdll.dll\NtQuerySystemInformation",  "UInt",SYSTEM_INFO_CLASS,  "UInt",&SystemCacheInfo,  "UInt",SystemInfoLength)

; Read values
CurrentSize := NumGet(SystemCacheInfo, 0, "UInt")
PeakSize := NumGet(SystemCacheInfo, 4, "UInt")
PageFaultCount := NumGet(SystemCacheInfo, 8, "UInt")
MinimumWorkingSet := NumGet(SystemCacheInfo, 12, "UInt")
MaximumWorkingSet := NumGet(SystemCacheInfo, 16, "UInt")
TransitionSharedPages := NumGet(SystemCacheInfo, 20, "UInt")
PeakTransitionSharedPages := NumGet(SystemCacheInfo, 24, "UInt")

; Tweak values to make correct
CurrentSize /= 1024
PeakSize /= 1024
MinimumWorkingSet *= 4
MaximumWorkingSet *= 4
TransitionSharedPages *= 4
PeakTransitionSharedPages *= 4
:D

_________________
My Ahk Site


Last edited by a_h_k on July 5th, 2010, 8:15 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2010, 6:12 pm 
Offline

Joined: January 21st, 2009, 1:06 pm
Posts: 63
a_h_k wrote:
After a bit of "detective work" i worked out that some "bit-shifting" was required (to give the correct values - as displayed in CacheSet)
a_h_k wrote:
To read the system info i used...
Code:
; Constant
SYSTEM_INFO_CLASS = 0x15

; Set buffer size
SystemInfoLength = 36
VarSetCapacity(SystemCacheInfo, SystemInfoLength, 0)      

; DLL call
DllCall("C:\Windows\system32\ntdll.dll\NtQuerySystemInformation",  "UInt",SYSTEM_INFO_CLASS,  "UInt",&SystemCacheInfo,  "UInt",SystemInfoLength)

; Read values
CurrentSize := NumGet(SystemCacheInfo, 0, "UInt")
PeakSize := NumGet(SystemCacheInfo, 4, "UInt")
PageFaultCount := NumGet(SystemCacheInfo, 8, "UInt")
MinimumWorkingSet := NumGet(SystemCacheInfo, 12, "UInt")
MaximumWorkingSet := NumGet(SystemCacheInfo, 16, "UInt")
TransitionSharedPages := NumGet(SystemCacheInfo, 20, "UInt")
PeakTransitionSharedPages := NumGet(SystemCacheInfo, 24, "UInt")

; Tweak values to make correct
CurrentSize /= 1024
PeakSize /= 1024
MinimumWorkingSet *= 4
MaximumWorkingSet *= 4
TransitionSharedPages *= 4
PeakTransitionSharedPages *= 4
:D


You, sir, are a gentleman and a scholar. Thank you for providing your source code! Im going to play around with it this afternoon and see if I can get NtSetSystemInformation() to work based on your examples.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, jrav and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group