Monitor nonPagedPool (Memory) in Java -
Is there any way to monitor nonPagedPool-Area of memory in Java? Can only read the total amount of memory used, but not this specific area of memory.
I decided to use and call to resolve the problem. Calling command line can be expensive and pretty ugly as I need to run walking procedures and nonpijed poles in every step. Fortunately, implementing it with JNA is not difficult:
Main-class:
import com.sun.jna Native; Public Sector JNA_PSAPI_Test_opitimized {Public Stable Domestic Boolean GetPerformanceInfo (Performance Information Center, pPerformanceInformation, int cb); Stable Registration ("psapi"); } Public static zero main (string [] args throws interrupted exposure {PerformanceInformationStruct tPerfInfo = new PerformanceInformationStruct (); While (true) {GetPerformanceInfo (tPerfInfo, 104); System.out.println ("NonPidPool (MB):" + tPerfInfo.KernelNonpaged * tPerfInfo.PageSize / Math.pow (1024,2)); Thread.Sleep (1000); }}}
Structure-class:
import java.util.Arrays; Import java.util.list; Import com.sun.jna.Structure; Public-Class Performance Information Center Extends Structure {Public Ent CB; Public CommitTotal long; Public CommitLimit Long; Public CommitPeak Long; Public long physical total; Public long physical available; Public long system cache; Public long kernelelt; Public long kernelpages; Public long cornelippage; Public long page size; Public Ink HandleCount; Public at proccount; Public internet connection; Public Performance Informatics () {super (); } @ Override Protected List & lt; String & gt; GetFieldOrder (return) Arrays.asList (new string [] {"CB", "Citrate", "Commitment", "Commitpak", "Physical", "Physical Available", "SystemCatch", "ColCollot", "kernelPage" Kernel nanpage "," pages "," handlankt "," processcount "," threadcount "}); }}
Comments
Post a Comment