Ticket #26454: patch-cpuinfo-tovid-init.in.diff

File patch-cpuinfo-tovid-init.in.diff, 885 bytes (added by danielb@…, 14 years ago)
  • src/tovid-init.in

    old new  
    455455KERNEL=$(uname)
    456456if test "$KERNEL" = "Linux"; then
    457457    # Linux should have /proc/cpuinfo
    458     CPU_MODEL=$(awk -F ":" '/model name/ {print $2}' /proc/cpuinfo | head -n 1)
    459     CPU_SPEED=$(awk 'BEGIN { IGNORECASE = 1 } /MHz/ { print $4 }' /proc/cpuinfo | head -n 1)
     458    CPU_MODEL=$(sysctl -n -a machdep.cpu.brand_string)
     459    CPU_SPEED=$(sysctl -n -a hw.cpufrequency)
     460    CPU_SPEED=$(bc_math '$CPU_SPEED / 1000000000')
    460461    # Test for multiple CPUs. If they are available, try to use them.
    461     if test $(grep "^processor" /proc/cpuinfo | wc -l) -ge "2"; then
     462    if test $(sysctl -n -a hw.activecpu) -ge "2"; then
    462463        MULTIPLE_CPUS=:
    463464    else
    464465        MULTIPLE_CPUS=false
    465466    fi
    466 elif test "$KERNEL" = "Darwin"; then
    467     :
    468467fi
    469468
    470469