21#if KMP_ARCH_X86 || KMP_ARCH_X86_64
28static int trace_level = 5;
39 if (frequency == NULL) {
42 value = strtod(frequency, &unit);
45 if (strcmp(unit,
"MHz") == 0) {
47 }
else if (strcmp(unit,
"GHz") == 0) {
49 }
else if (strcmp(unit,
"THz") == 0) {
60void __kmp_query_cpuid(kmp_cpuinfo_t *
p) {
71 __kmp_x86_cpuid(0, 0, &
buf);
74 (
"INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n", 0,
85 __kmp_x86_cpuid(1, 0, &
buf);
87 (
"INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
91#define get_value(reg, lo, mask) (((reg) >> (lo)) & (mask))
93 p->signature =
buf.eax;
94 p->family = get_value(
buf.eax, 20, 0xff) + get_value(
buf.eax, 8, 0x0f);
96 (get_value(
buf.eax, 16, 0x0f) << 4) + get_value(
buf.eax, 4, 0x0f);
97 p->stepping = get_value(
buf.eax, 0, 0x0f);
101 KA_TRACE(trace_level, (
" family = %d, model = %d, stepping = %d\n",
102 p->family,
p->model,
p->stepping));
105 for (t =
buf.ebx,
i = 0; i < 4; t >>= 8, ++
i) {
106 data[
i] = (t & 0xff);
109 p->flags.sse2 = (
buf.edx >> 26) & 1;
113 if ((
buf.edx >> 4) & 1) {
117 if ((
buf.edx >> 8) & 1) {
121 if ((
buf.edx >> 9) & 1) {
125 if ((
buf.edx >> 15) & 1) {
129 if ((
buf.edx >> 18) & 1) {
133 if ((
buf.edx >> 19) & 1) {
137 KA_TRACE(trace_level, (
" CLFLUSH(%db)", cflush_size));
139 if ((
buf.edx >> 21) & 1) {
143 if ((
buf.edx >> 22) & 1) {
147 if ((
buf.edx >> 23) & 1) {
151 if ((
buf.edx >> 25) & 1) {
155 if ((
buf.edx >> 26) & 1) {
159 if ((
buf.edx >> 27) & 1) {
165 if ((
buf.edx >> 28) & 1) {
167 p->apic_id =
data[3];
171 if ((
buf.edx >> 29) & 1) {
173 KA_TRACE(trace_level, (
" ATHROTL"));
177 for (
i = 2;
i <= max_arg; ++
i) {
178 __kmp_x86_cpuid(
i, 0, &
buf);
180 (
"INFO: CPUID %d: EAX=0x%08X EBX=0x%08X ECX=0x%08X EDX=0x%08X\n",
189 __kmp_x86_cpuid(7, 0, &
buf);
190 p->flags.rtm = (
buf.ebx >> 11) & 1;
191 p->flags.hybrid = (
buf.edx >> 15) & 1;
195 if (
p->flags.hybrid) {
203 kmp_cpuid_t *base = (kmp_cpuid_t *)&
p->name[0];
206 for (
i = 0;
i < 3; ++
i) {
207 __kmp_x86_cpuid(0x80000002 +
i, 0, base +
i);
209 p->name[
sizeof(
p->name) - 1] = 0;
210 KA_TRACE(trace_level, (
"cpu brand string: \"%s\"\n", &
p->name[0]));
213 p->frequency = __kmp_parse_frequency(strrchr(&
p->name[0],
' '));
215 (
"cpu frequency from brand string: %" KMP_UINT64_SPEC
"\n",
228 if (!GetComputerNameA(buffer, &
s))
234 buffer[
size - 2] = 0;
235 if (gethostname(buffer,
size) || buffer[
size - 2] != 0)
250 int default_cpu_width = 1;
261 if (pattern != NULL) {
262 while (*pattern !=
'\0' && pos <
end) {
263 if (*pattern !=
'%') {
266 char *old_pattern = pattern;
268 int cpu_width = default_cpu_width;
272 if (*pattern >=
'0' && *pattern <=
'9') {
275 width = (width * 10) + *pattern++ -
'0';
276 }
while (*pattern >=
'0' && *pattern <=
'9');
277 if (width < 0 || width > 1024)
299 if (snp_result >= 0 && snp_result <=
end - pos) {
309#if (KMP_ARCH_X86_64 || KMP_ARCH_AARCH64) && defined(__MINGW32__)
314 if (snp_result >= 0 && snp_result <=
end - pos) {
329 pattern = old_pattern + 1;
336 if (*pattern !=
'\0')
348 const char *runtime_version) {
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void * data
void const char const char int ITT_FORMAT __itt_group_sync s
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void const char const char int ITT_FORMAT __itt_group_sync p
#define KMP_DEBUG_ASSERT(cond)
unsigned long long kmp_uint64
#define KMP_STRCPY_S(dst, bsz, src)
void ompt_libomp_connect(ompt_start_tool_result_t *result)
struct ompt_start_tool_result_t ompt_start_tool_result_t
static const char * unknown
void __kmp_expand_file_name(char *result, size_t rlen, char *pattern)
void __kmp_expand_host_name(char *buffer, size_t size)