27double tsc_tick_count::tick_time() {
29 return 1 / ((
double)1000 * 1.e6);
31#elif KMP_ARCH_X86 || KMP_ARCH_X86_64
34double tsc_tick_count::tick_time() {
35 static double result = 0.0;
41 __kmp_x86_cpuid(0x80000000, 0, &cpuinfo);
42 memset(brand, 0,
sizeof(brand));
43 int ids = cpuinfo.eax;
45 for (
unsigned int i = 2;
i < (ids ^ 0x80000000) + 2;
i++)
46 __kmp_x86_cpuid(
i | 0x80000000, 0,
47 (kmp_cpuid_t *)(brand + (
i - 2) *
sizeof(kmp_cpuid_t)));
49 char *start = &brand[0];
50 for (; *start ==
' '; start++)
57 multiplier = 1000LL * 1000LL;
59 multiplier = 1000LL * 1000LL * 1000LL;
61 multiplier = 1000LL * 1000LL * 1000LL * 1000LL;
63 cout <<
"Error determining multiplier '" << *
end <<
"'\n";
71 double freq = strtod(
end, &start);
73 cout <<
"Error calculating frequency " <<
end <<
"\n";
88std::string
formatSI(
double interval,
int width,
char unit) {
97 } ranges[] = {{1.e21,
'y'}, {1.e18,
'z'}, {1.e15,
'a'}, {1.e12,
'f'},
98 {1.e9,
'p'}, {1.e6,
'n'}, {1.e3,
'u'}, {1.0,
'm'},
99 {1.e-3,
' '}, {1.e-6,
'k'}, {1.e-9,
'M'}, {1.e-12,
'G'},
100 {1.e-15,
'T'}, {1.e-18,
'P'}, {1.e-21,
'E'}, {1.e-24,
'Z'},
103 if (interval == 0.0) {
104 os << std::setw(width - 3) << std::right <<
"0.00" << std::setw(3)
109 bool negative =
false;
110 if (interval < 0.0) {
112 interval = -interval;
115 for (
int i = 0;
i < (
int)(
sizeof(ranges) /
sizeof(ranges[0]));
i++) {
116 if (interval * ranges[
i].scale < 1.e0) {
117 interval = interval * 1000.e0 * ranges[
i].scale;
118 os << std::fixed << std::setprecision(2) << std::setw(width - 3)
119 << std::right << (negative ? -interval : interval) << std::setw(2)
120 << ranges[
i].prefix << std::setw(1) << unit;
126 os << std::setprecision(2) << std::fixed << std::right << std::setw(width - 3)
127 << interval << std::setw(3) << unit;
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 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 ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
KMP_ARCH_X86 KMP_ARCH_X86 long double
std::string formatSI(double interval, int width, char unit)
Access to real time clock and timers.