Ejemplo n.º 1
0
void kmp_stats_output_module::printCounters(FILE * statsOut, counter const * theCounters)
{
    // We print all the counters even if they are zero.
    // That makes it easier to slice them into a spreadsheet if you need to.
    fprintf (statsOut, "\nCounter,                    Count\n");
    for (int c = 0; c<COUNTER_LAST; c++) {
        counter const * stat = &theCounters[c];
        fprintf (statsOut, "%-25s, %s\n", counter::name(counter_e(c)), formatSI(stat->getValue(), 9, ' ').c_str());
    }
}
Ejemplo n.º 2
0
/* Print some useful information about
   * the date and time this experiment ran.
   * the machine on which it ran.
   We output all of this as stylised comments, though we may decide to parse
   some of it. */
void kmp_stats_output_module::printHeaderInfo(FILE *statsOut) {
  std::time_t now = std::time(0);
  char buffer[40];
  char hostName[80];

  std::strftime(&buffer[0], sizeof(buffer), "%c", std::localtime(&now));
  fprintf(statsOut, "# Time of run: %s\n", &buffer[0]);
  if (gethostname(&hostName[0], sizeof(hostName)) == 0)
    fprintf(statsOut, "# Hostname: %s\n", &hostName[0]);
#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);
  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
}
Ejemplo n.º 3
0
std::string statistic::format(char unit, bool total) const
{
    std::string result = formatSI(sampleCount,9,' ');
    
    if (sampleCount == 0)
    {
        result = result + std::string(", ") + formatSI(0.0, 9, unit);
        result = result + std::string(", ") + formatSI(0.0, 9, unit);
        result = result + std::string(", ") + formatSI(0.0, 9, unit);
        if (total)
            result = result + std::string(", ") + formatSI(0.0, 9, unit);
        result = result + std::string(", ") + formatSI(0.0, 9, unit);
    }
    else
    {
        result = result + std::string(", ") + formatSI(minVal,  9, unit);
        result = result + std::string(", ") + formatSI(meanVal, 9, unit);
        result = result + std::string(", ") + formatSI(maxVal,  9, unit);
        if (total)
            result = result + std::string(", ") + formatSI(meanVal*sampleCount, 9, unit);
        result = result + std::string(", ") + formatSI(getSD(), 9, unit);
    }
    return result;
}