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 op=0,
a;
47 static volatile int ans[4];
50 #if defined(__x86_64__) && !defined(__APPLE__)
52 __asm__ __volatile__ (
"pushq %%rdx;\
66 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(
a)
70 #elif defined(__i386__) && !defined(__APPLE__)
73 __asm__ __volatile__ (
"pushl %%edx;\
87 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(
a)
93 const char* unknown_str =
"Unknown";
95 strcpy((
char*)&ans[0],unknown_str);
98 const char* amd_str =
"AuthenticAMD";
99 int amd_sz = strlen(amd_str);
100 const char* intel_str =
"GenuineIntel";
101 int intel_sz = strlen(intel_str);
103 char* str = (
char*)&ans[0];
106 return strncmp(str,amd_str,amd_sz)==0?AMD_CPU:
107 strncmp(str,intel_str,intel_sz)==0?INTEL_CPU:UNKNOWN_CPU;
111 const MallocOpts intel_opts(262144, 524288, 5242880, 131072);
112 const MallocOpts amd_opts(0, 8388608, 131072, 10485760);
121 switch(get_cpu_type())
151 std::cerr <<
"ERROR: Reset of malloc options has fails:\n"
167 #ifdef M_TRIM_THRESHOLD
175 #ifdef M_MMAP_THRESHOLD
183 const char*
par = getenv(
"CMSRUN_MALLOC_RESET");
184 if(par==0)
return false;
185 std::string spar(par);
192 std::istringstream ist(spar);
198 std::cerr <<
"bad malloc options in CMSRUN_MALLOC_RESET: "
201 <<
"CMSRUN_MALLOC_RESET=\"mmap_max trim_thres top_pad mmap_thres\"\n";
205 std::cout <<
"MALLOC_OPTIONS> Reset options: "
206 <<
"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()
const double par[8 *NPar][4]