Skip to content
Snippets Groups Projects
Commit bfbd7c6d authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

CHOP-753: On Windows, add GetPerformanceInfo to LLMemoryInfo stats.

So far we've only been querying GlobalMemoryStatusEx(), but
GetPerformanceInfo() delivers a bunch more memory-related stats that may be
pertinent. Try capturing those too. May not yet compile on Windows...
parent abf50e8c
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ using namespace llsd; ...@@ -58,6 +58,7 @@ using namespace llsd;
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <winsock2.h> # include <winsock2.h>
# include <windows.h> # include <windows.h>
# include <psapi.h>
#elif LL_DARWIN #elif LL_DARWIN
# include <errno.h> # include <errno.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
...@@ -873,6 +874,25 @@ LLSD LLMemoryInfo::loadStatsArray() ...@@ -873,6 +874,25 @@ LLSD LLMemoryInfo::loadStatsArray()
statsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024))); statsArray.append(LLSDArray("Total Virtual KB") (LLSD::Integer(state.ullTotalVirtual/1024)));
statsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024))); statsArray.append(LLSDArray("Avail Virtual KB") (LLSD::Integer(state.ullAvailVirtual/1024)));
PERFORMANCE_INFORMATION perf;
perf.cb = sizeof(perf);
GetPerformanceInfo(&perf, sizeof(perf));
SIZE_T pagekb(perf.PageSize/1024);
statsArray.append(LLSDArray("CommitTotal KB") (LLSD::Integer(perf.CommitTotal * pagekb)));
statsArray.append(LLSDArray("CommitLimit KB") (LLSD::Integer(perf.CommitLimit * pagekb)));
statsArray.append(LLSDArray("CommitPeak KB") (LLSD::Integer(perf.CommitPeak * pagekb)));
statsArray.append(LLSDArray("PhysicalTotal KB") (LLSD::Integer(perf.PhysicalTotal * pagekb)));
statsArray.append(LLSDArray("PhysicalAvail KB") (LLSD::Integer(perf.PhysicalAvailable * pagekb)));
statsArray.append(LLSDArray("SystemCache KB") (LLSD::Integer(perf.SystemCache * pagekb)));
statsArray.append(LLSDArray("KernelTotal KB") (LLSD::Integer(perf.KernelTotal * pagekb)));
statsArray.append(LLSDArray("KernelPaged KB") (LLSD::Integer(perf.KernelPaged * pagekb)));
statsArray.append(LLSDArray("KernelNonpaged KB")(LLSD::Integer(perf.KernelNonpaged * pagekb)));
statsArray.append(LLSDArray("PageSize KB") (LLSD::Integer(pagekb)));
statsArray.append(LLSDArray("HandleCount") (LLSD::Integer(perf.HandleCount)));
statsArray.append(LLSDArray("ProcessCount") (LLSD::Integer(perf.ProcessCount)));
statsArray.append(LLSDArray("ThreadCount") (LLSD::Integer(perf.ThreadCount)));
#elif LL_DARWIN #elif LL_DARWIN
uint64_t phys = 0; uint64_t phys = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment