15 #if !defined(__APPLE__) 35 typedef enum { UNKNOWN_CPU = 0, AMD_CPU = 1, INTEL_CPU = 2 }
cpu_type;
45 static volatile int op = 0, a;
46 static volatile int ans[4];
49 #if defined(__x86_64__) 51 __asm__ __volatile__(
"pushq %%rdx;\ 65 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(a)
68 #elif defined(__i386__) 70 __asm__ __volatile__(
"pushl %%edx;\ 84 :
"=m"(ans[2]),
"=m"(ans[1]),
"=m"(ans[0]),
"=m"(a)
88 const char* unknown_str =
"Unknown";
90 strcpy((
char*)&ans[0], unknown_str);
93 const char* amd_str =
"AuthenticAMD";
94 int amd_sz = strlen(amd_str);
95 const char* intel_str =
"GenuineIntel";
96 int intel_sz = strlen(intel_str);
98 char* str = (
char*)&ans[0];
101 return strncmp(str, amd_str, amd_sz) == 0 ?
103 strncmp(str, intel_str, intel_sz) == 0 ? INTEL_CPU : UNKNOWN_CPU;
107 const MallocOpts intel_opts(262144, 524288, 5242880, 131072);
108 const MallocOpts amd_opts(0, 8388608, 131072, 10485760);
116 switch (get_cpu_type()) {
140 std::cerr <<
"ERROR: Reset of malloc options has fails:\n" 158 #ifdef M_TRIM_THRESHOLD 166 #ifdef M_MMAP_THRESHOLD 175 const char* par = getenv(
"ART_MALLOC_RESET");
178 std::string spar(par);
183 if (spar.size() > 1) {
184 std::istringstream ist(spar);
190 <<
"bad malloc options in ART_MALLOC_RESET: " << spar <<
"\n" 192 <<
"ART_MALLOC_RESET=\"mmap_max trim_thres top_pad mmap_thres\"\n";
194 std::cout <<
"MALLOC_OPTIONS> Reset options: " 195 <<
"ART_MALLOC_RESET=" << par <<
"\n";
std::ostream & operator<<(std::ostream &os, EDAnalyzer::Table< T > const &t)
bool retrieveFromCpuType()
std::string error_message_
MallocOptionSetter global_malloc_options
MallocOptionSetter & getGlobalOptionSetter()
void adjustMallocParams()