[Openmp-commits] [openmp] r263583 - [STATS] Print "Unknown" for frequency if it wasn't able to be parsed

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 15 13:55:33 PDT 2016


Author: jlpeyton
Date: Tue Mar 15 15:55:32 2016
New Revision: 263583

URL: http://llvm.org/viewvc/llvm-project?rev=263583&view=rev
Log:
[STATS] Print "Unknown" for frequency if it wasn't able to be parsed

Modified:
    openmp/trunk/runtime/src/kmp_stats.cpp
    openmp/trunk/runtime/src/kmp_utility.c

Modified: openmp/trunk/runtime/src/kmp_stats.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_stats.cpp?rev=263583&r1=263582&r2=263583&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_stats.cpp (original)
+++ openmp/trunk/runtime/src/kmp_stats.cpp Tue Mar 15 15:55:32 2016
@@ -482,7 +482,10 @@ void kmp_stats_output_module::printHeade
 #if KMP_ARCH_X86 || KMP_ARCH_X86_64
     fprintf (statsOut, "# CPU:  %s\n", &__kmp_cpuinfo.name[0]);
     fprintf (statsOut, "# Family: %d, Model: %d, Stepping: %d\n", __kmp_cpuinfo.family, __kmp_cpuinfo.model, __kmp_cpuinfo.stepping);
-    fprintf (statsOut, "# Nominal frequency: %sz\n", formatSI(double(__kmp_cpuinfo.frequency),9,'H').c_str());
+    if (__kmp_cpuinfo.frequency == 0)
+        fprintf (statsOut, "# Nominal frequency: Unknown\n");
+    else
+        fprintf (statsOut, "# Nominal frequency: %sz\n", formatSI(double(__kmp_cpuinfo.frequency),9,'H').c_str());
 #endif
 }
 

Modified: openmp/trunk/runtime/src/kmp_utility.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_utility.c?rev=263583&r1=263582&r2=263583&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_utility.c (original)
+++ openmp/trunk/runtime/src/kmp_utility.c Tue Mar 15 15:55:32 2016
@@ -109,7 +109,7 @@ __kmp_parse_frequency(        // R: Freq
 
     double       value  = 0.0;
     char const * unit   = NULL;
-    kmp_uint64   result = ~ 0;
+    kmp_uint64   result = 0;                    /* Zero is a better unknown value than all ones. */
 
     if ( frequency == NULL ) {
         return result;




More information about the Openmp-commits mailing list