15 #if !defined(__APPLE__)
37 typedef enum { UNKNOWN_CPU=0, AMD_CPU=1, INTEL_CPU=2 } cpu_type;
39 cpu_type get_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"
169 #ifdef M_TRIM_THRESHOLD
177 #ifdef M_MMAP_THRESHOLD
185 const char* par = getenv(
"CMSRUN_MALLOC_RESET");
186 if(par==0)
return false;
194 std::istringstream ist(spar);
200 std::cerr <<
"bad malloc options in CMSRUN_MALLOC_RESET: "
203 <<
"CMSRUN_MALLOC_RESET=\"mmap_max trim_thres top_pad mmap_thres\"\n";
207 std::cout <<
"MALLOC_OPTIONS> Reset options: "
208 <<
"CMSRUN_MALLOC_RESET=" << par <<
"\n";
std::string error_message_
void adjustMallocParams()
volatile std::atomic< bool > shutdown_flag false
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
MallocOptionSetter global_malloc_options
bool retrieveFromCpuType()
MallocOptionSetter & getGlobalOptionSetter()