14 #if !defined(__APPLE__) 31 typedef enum { UNKNOWN_CPU = 0, AMD_CPU = 1, INTEL_CPU = 2 }
cpu_type;
39 static volatile int ans[4];
40 #if defined(__i386__) || defined(__x86_64__) 41 static volatile int op = 0,
a;
45 #if defined(__x86_64__) 62 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(
a)
65 #elif defined(__i386__) 82 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(
a)
86 const char* unknown_str =
"Unknown";
88 strcpy((
char*)&ans[0], unknown_str);
91 const char* amd_str =
"AuthenticAMD";
92 int amd_sz = strlen(amd_str);
93 const char* intel_str =
"GenuineIntel";
94 int intel_sz = strlen(intel_str);
96 char*
str = (
char*)&ans[0];
99 return strncmp(str, amd_str, amd_sz) == 0 ? AMD_CPU
100 : strncmp(str, intel_str, intel_sz) == 0 ? INTEL_CPU : UNKNOWN_CPU;
104 const MallocOpts intel_opts(262144, 524288, 5242880, 131072);
105 const MallocOpts amd_opts(0, 8388608, 131072, 10485760);
112 switch (get_cpu_type()) {
146 #ifndef __SANITIZE_ADDRESS__ 151 #ifdef M_TRIM_THRESHOLD 159 #ifdef M_MMAP_THRESHOLD 167 const char* par = getenv(
"CMSRUN_MALLOC_RESET");
175 if (spar.size() > 1) {
176 std::istringstream ist(spar);
180 std::cerr <<
"bad malloc options in CMSRUN_MALLOC_RESET: " << spar <<
"\n" 182 <<
"CMSRUN_MALLOC_RESET=\"mmap_max trim_thres top_pad mmap_thres\"\n";
184 std::cout <<
"MALLOC_OPTIONS> Reset options: " 185 <<
"CMSRUN_MALLOC_RESET=" << par <<
"\n";
std::string error_message_
void adjustMallocParams()
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
MallocOptionSetter global_malloc_options
bool retrieveFromCpuType()
MallocOptionSetter & getGlobalOptionSetter()