15 #if !defined(__APPLE__) 37 typedef enum { UNKNOWN_CPU=0, AMD_CPU=1, INTEL_CPU=2 }
cpu_type;
46 static volatile int ans[4];
47 #if defined(__i386__) || defined(__x86_64__) 48 static volatile int op=0,
a;
52 #if defined(__x86_64__) 54 __asm__ __volatile__ (
"pushq %%rdx;\ 68 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(
a)
72 #elif defined(__i386__) 75 __asm__ __volatile__ (
"pushl %%edx;\ 89 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(
a)
95 const char* unknown_str =
"Unknown";
97 strcpy((
char*)&ans[0],unknown_str);
100 const char* amd_str =
"AuthenticAMD";
101 int amd_sz = strlen(amd_str);
102 const char* intel_str =
"GenuineIntel";
103 int intel_sz = strlen(intel_str);
105 char*
str = (
char*)&ans[0];
108 return strncmp(str,amd_str,amd_sz)==0?AMD_CPU:
109 strncmp(str,intel_str,intel_sz)==0?INTEL_CPU:UNKNOWN_CPU;
113 const MallocOpts intel_opts(262144, 524288, 5242880, 131072);
114 const MallocOpts amd_opts(0, 8388608, 131072, 10485760);
123 switch(get_cpu_type())
153 std::cerr <<
"ERROR: Reset of malloc options has fails:\n" 165 #ifndef __SANITIZE_ADDRESS__ 170 #ifdef M_TRIM_THRESHOLD 178 #ifdef M_MMAP_THRESHOLD 187 const char* par = getenv(
"CMSRUN_MALLOC_RESET");
188 if(par==0)
return false;
196 std::istringstream ist(spar);
202 std::cerr <<
"bad malloc options in CMSRUN_MALLOC_RESET: " 205 <<
"CMSRUN_MALLOC_RESET=\"mmap_max trim_thres top_pad mmap_thres\"\n";
209 std::cout <<
"MALLOC_OPTIONS> Reset options: " 210 <<
"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()