About This Mac

Discussion in 'Mac Programming' started by john903, Apr 28, 2008.

  1. john903 macrumors member

    Joined:
    Apr 11, 2008
    #1
    How do obtain the values found in About This Mac -> More Info... such as Model Name or Processor Name in a carbon application?
     
  2. zaney macrumors regular

    Joined:
    Apr 6, 2008
    Location:
    Middle of a field, UK
    #2
    I've never written a Carbon app, but I seem to remember reading somewhere that you can launch Apple System Profiler, and get the information via Apple events.
    I can't help you out more myself, but it might give you a new direction for google searches.
     
  3. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #3
    Use sysctl APIs:

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <sys/sysctl.h>
    
    int main() {
    	int hertz;
    	size_t size = sizeof(int);
    	int mib[2] = {CTL_HW, HW_CPU_FREQ};
    	
    	sysctl(mib, 2, &hertz, &size, NULL, 0);
    	printf("%d\n", hertz);
    	return EXIT_SUCCESS;
    }
     
  4. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #4
    I'm still digging through the output, but did a ktrace on SystemProfiler. So far this file:
    "/System/Library/SystemProfiler/SPPlatformReporter.spreporter/Contents/Resources/SPMachineTypes.plist"
    is where the machine descriptions come from. Still trying to see where it gets the key. ktrace output might not be enough, but I was thinking it might point to the framework or frameworks that are used.

    -Lee

    Also got the output of Strings from the SPPlatformReporter binary, some method and property names in there, it looks like. It might at least help your googling:
    @12@0:4@8
    @12@0:4S8
    @8@0:4
    base2SizeString
    numberWithUnsignedLongLong:
    dictionaryWithContentsOfFile:
    pathForResource:eek:fType:
    bundleForClass:
    class
    stringWithUTF8String:
    numberWithInt:
    self
    UTF8String
    componentsSeparatedByString:
    length
    release
    stringWithCString:
    bytes
    setObject:forKey:
    stringValue
    dictionary
    stringWithFormat:
    addEntriesFromDictionary:
    objectAtIndex:
    addObject:
    objectForKey:
    updateDictionary:
    marketingStringForMHz:
    bootromDictionary
    cpuDictionary
    AMSDictionary
    SMCDictionary
    BMCDictionary
    platformDictionary
    NSDictionary
    NSBundle
    NSNumber
    NSMutableDictionary
    NSString
    NSObject
    SPReporter
    SPPlatformReporter
    _items
    IOPlatformExpertDevice
    serial-number
    IOPlatformSerialNumber
    serial_number
    sales_order_number
    IODeviceTree:/rom
    version
    %@.%@.%@
    boot_rom_version
    cpu_type
    IOResources
    IOSMSClass
    IOI2CMotionSensor
    PMUMotionSensor
    ams-active
    MMM_state
    MMM_enabled
    MMM_disabled
    ams-application-version
    MMM_version
    %d.%d
    MMM_entry
    AppleSMC
    smc-version
    SMC_version
    AppleKCS
    BMC Revision
    LOM_revision
    _name
    hardware_overview
    hw.physicalcpu
    number_processors
    machine_model
    plist
    SPMachineTypes
    machine_name
    hw.cpufrequency_max
    current_processor_speed
    machdep.cpu.logical_per_core
    hw.logicalcpu
    platform_cpu_htt
    htt_enabled
    htt_disabled
    physical_memory
    hw.cacheconfig
    packages
    l2_cache_share
    l2_cache
    l3_cache_size
    bus_speed
    %d MHz
    %.*f GHz
    Intel Core Solo
    Intel Core Duo
    Intel Core 2 Solo
    Intel Core 2 Duo
    Single-Core Intel Xeon
    Dual-Core Intel Xeon
    Unknown Intel Xeon
    Quad-Core Intel Xeon
    PowerPC
    PowerPC 601
    PowerPC 602
    PowerPC 603
    PowerPC 603e
    PowerPC 603ev
    PowerPC 604
    PowerPC 604e
    PowerPC 620
    PowerPC G3
    PowerPC 750
    PowerPC G4
    PowerPC 7400
    PowerPC 7450
    PowerPC G5
    PowerPC 970
    MHzFormat
    GHzFormat
    IntelSpeedAndTypeFormat
    Intel1xCPUFormat
    Intel2xCPUFormat
    Intel3xCPUFormat
    Intel4xCPUFormat
    IntelNxCPUFormat
    UnknownCPUKind
    %1$@ %2$@
    2 x %@
    3 x %@
    4 x %@
    %1$d x %2$@
    Unknown
    AppleSystemInfo
    /System/Library/CoreServices/
    machdep.cpu.brand_string
    Xeon
    hw.cpufrequency
    ASI_CopyComputerModelName
    /System/Library/SystemProfiler/SPPlatformReporter.spreporter
    Localizable
    ASI_NumberOfCPUs
    IODeviceTree:/efi
    hw.cpufamily
    machdep.cpu.cores_per_package
    ASI_CopyCPUKind
    IODeviceTree:/cpus/CPU0@0
    cpu-type
    cpu-type data length incorrect size, expect 2, received %d
    ASI_BusSpeedInHz
    ASI_CopyCPUDescription
    ASI_CopyCurrentCPUDescription
    ASI_CopyBusSpeedDescription
     

Share This Page