Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.sun.jna.Native;
- public class JNA_PSAPI_Test_optimized {
- public static native boolean GetPerformanceInfo(PerformanceInformationStruct pPerformanceInformation, int cb);
- static {
- Native.register("psapi");
- }
- public static void main(String[] args) throws InterruptedException {
- PerformanceInformationStruct tPerfInfo = new PerformanceInformationStruct();
- while (true){
- GetPerformanceInfo(tPerfInfo, 104);
- System.out.println("nonPagedPool (MB): "+tPerfInfo.KernelNonpaged * tPerfInfo.PageSize / Math.pow(1024,2));
- Thread.sleep(1000);
- }
- }
- }
- import java.util.Arrays;
- import java.util.List;
- import com.sun.jna.Structure;
- public class PerformanceInformationStruct extends Structure {
- public int cb;
- public long CommitTotal;
- public long CommitLimit;
- public long CommitPeak;
- public long PhysicalTotal;
- public long PhysicalAvailable;
- public long SystemCache;
- public long KernelTotal;
- public long KernelPaged;
- public long KernelNonpaged;
- public long PageSize;
- public int HandleCount;
- public int ProcessCount;
- public int ThreadCount;
- public PerformanceInformationStruct() {
- super();
- }
- @Override
- protected List<String> getFieldOrder() {
- return Arrays.asList(new String[]{"cb", "CommitTotal", "CommitLimit", "CommitPeak", "PhysicalTotal", "PhysicalAvailable", "SystemCache", "KernelTotal", "KernelPaged", "KernelNonpaged", "PageSize", "HandleCount", "ProcessCount", "ThreadCount"});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement