This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9886 for ps


Ignore:
Timestamp:
07/20/11 10:10:36 (13 years ago)
Author:
Jan Wassenberg
Message:

OS X fix: if os_cpu_ClockFrequency reports an unknown/invalid value, measure the frequency instead; also avoid reporting invalid freqs in system_info

Location:
ps/trunk/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/lib/sysdep/arch/x86_x64/x86_x64.cpp

    r9871 r9886  
    480480    size_t numSamples = 16;
    481481    // if clock is low-res, do less samples so it doesn't take too long.
    482     // balance measuring time (~ 10 ms) and accuracy (< 1 0/00 error -
     482    // balance measuring time (~ 10 ms) and accuracy (< 0.1% error -
    483483    // ok for using the TSC as a time reference)
    484484    if(timer_Resolution() >= 1e-3)
  • ps/trunk/source/ps/Util.cpp

    r9572 r9886  
    101101    // CPU
    102102    fprintf(f, "CPU            : %s, %s (%dx%dx%d)", un.machine, cpu_IdentifierString(), (int)cpu_topology_NumPackages(), (int)cpu_topology_CoresPerPackage(), (int)cpu_topology_LogicalPerCore());
    103     const double cpu_freq = os_cpu_ClockFrequency();
    104     if(cpu_freq != 0.0f)
    105     {
    106         if(cpu_freq < 1e9)
    107             fprintf(f, ", %.2f MHz\n", cpu_freq*1e-6);
     103    double cpuClock = os_cpu_ClockFrequency();  // query OS (may fail)
     104    if(cpuClock <= 0.0)
     105        cpuClock = x86_x64_ClockFrequency();    // measure (takes a few ms)
     106    if(cpuClock > 0.0)
     107    {
     108        if(cpuClock < 1e9)
     109            fprintf(f, ", %.2f MHz\n", cpuClock*1e-6);
    108110        else
    109             fprintf(f, ", %.2f GHz\n", cpu_freq*1e-9);
     111            fprintf(f, ", %.2f GHz\n", cpuClock*1e-9);
    110112    }
    111113    else
Note: See TracChangeset for help on using the changeset viewer.