Initial commit of snmalloc

History squashed from internal development.

Internal history has commit hash:
  e27a0e485c44a5003a802de2661ce3b21e120316
This commit is contained in:
Matthew Parkinson
2019-01-15 14:17:55 +00:00
parent e488c24784
commit 4f9d991449
53 changed files with 6940 additions and 329 deletions

42
src/test/usage.h Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <windows.h>
// Needs to be included after windows.h
# include <psapi.h>
#endif
#include <iomanip>
#include <iostream>
namespace usage
{
void print_memory()
{
#if defined(_WIN32)
PROCESS_MEMORY_COUNTERS_EX pmc;
if (!GetProcessMemoryInfo(
GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc)))
return;
std::cout << "Memory info:" << std::endl
<< "\tPageFaultCount: " << pmc.PageFaultCount << std::endl
<< "\tPeakWorkingSetSize: " << pmc.PeakWorkingSetSize << std::endl
<< "\tWorkingSetSize: " << pmc.WorkingSetSize << std::endl
<< "\tQuotaPeakPagedPoolUsage: " << pmc.QuotaPeakPagedPoolUsage
<< std::endl
<< "\tQuotaPagedPoolUsage: " << pmc.QuotaPagedPoolUsage
<< std::endl
<< "\tQuotaPeakNonPagedPoolUsage: "
<< pmc.QuotaPeakNonPagedPoolUsage << std::endl
<< "\tQuotaNonPagedPoolUsage: " << pmc.QuotaNonPagedPoolUsage
<< std::endl
<< "\tPagefileUsage: " << pmc.PagefileUsage << std::endl
<< "\tPeakPagefileUsage: " << pmc.PeakPagefileUsage << std::endl
<< "\tPrivateUsage: " << pmc.PrivateUsage << std::endl;
#endif
}
};