Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 558317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:07:08+00:00 2026-05-13T12:07:08+00:00

Is there a reliable, quick, deterministic way (i.e. not a benchmark) to check whether

  • 0

Is there a reliable, quick, deterministic way (i.e. not a benchmark) to check whether the system drive Mac OS X is on is a Solid State Drive?

Is there any other indicator how well disk handles parallel access? I’m trying to adjust number of threads that my program is going to use for disk-bound operations.

I’m not interested in raw speed or seek time, only which type of access – serial or parallel – is faster for the drive. I don’t expect users of my program to use iSCSI or RAID. SSD is my focus, anything else is nice-to-have.

Device Characteristics of IOAHCIBlockStorageDevice contains this information. How can I read it programmatically?


So far I’ve figured out it goes like this: (following is pseudocode)

match = IOBSDNameMatching(kIOMasterPortDefault,0,"disk0s2");
IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iterator);
while(entry = IOIteratorNext(iterator)) {
   do {
     entry = IORegistryEntryGetParentEntry(nextMedia, kIOServicePlane, &entry);
     dict = IORegistryEntryCreateCFProperty(nextMedia, 
            CFSTR(kIOPropertyDeviceCharacteristicsKey), kCFAllocatorDefault, 0);
     [dict objectForKey:CFSTR(kIOPropertyMediumTypeKey)];
   } 
   while(!dict && entry); 
}

Edit: Here’s complete source code. I’ve verified it works with Intel SSD and OCZ Vertex.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:07:09+00:00Added an answer on May 13, 2026 at 12:07 pm

    If you’re trying to get that kind of information, you’re best guess is IOKit.

    You can try some of it’s functionality using the ioreg command line tool or the IORegistryExplorer.


    Here’s some code that might help you. It fetches all hard drives that aren’t a RAID and aren’t partitions. This isn’t what you want, but it might get you started.

    #import "TWDevice.h"
    
    #include <stdio.h>
    #include <string.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <sys/ioctl.h>
    #include <errno.h>
    #include <paths.h>
    #include <sys/param.h>
    #include <IOKit/IOKitLib.h>
    #include <IOKit/IOBSD.h>
    #include <IOKit/storage/IOMedia.h>
    #include <CoreFoundation/CoreFoundation.h>
    #include <IOKit/Kext/KextManager.h>
    
    
    @implementation TWDevice
    
    @synthesize name, devicePath, size, blockSize, writable, icon;
    
    + (NSArray *)allDevices {
        // create matching dictionary
        CFMutableDictionaryRef classesToMatch;
        classesToMatch = IOServiceMatching(kIOMediaClass);
        if (classesToMatch == NULL) {
            [NSException raise:@"TWError" format:@"Classes to match could not be created"];
        }
    
        // get iterator of matching services
        io_iterator_t mediaIterator;
        kern_return_t kernResult;
        kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault,
                                                                          classesToMatch,
                                                                          &mediaIterator);
    
        if (kernResult != KERN_SUCCESS) {
            [NSException raise:@"TWError" format:@"Matching services did not succed."];
        }
    
        // iterate over all found medias
        io_object_t nextMedia;
        NSMutableArray *detectedDevices = [NSMutableArray array];
        while (nextMedia = IOIteratorNext(mediaIterator)) {
            NSMutableDictionary *properties;
            kernResult = IORegistryEntryCreateCFProperties(nextMedia,
                                                                                      (CFMutableDictionaryRef *)&properties,
                                                                                      kCFAllocatorDefault, 0);
    
            if (kernResult != KERN_SUCCESS) {
                [NSException raise:@"TWError" format:@"Getting properties threw error."];
            }
    
            // is it a whole device or just a partition?
            if ([[properties valueForKey:@"Whole"] boolValue] &&
                ![[properties valueForKey:@"RAID"] boolValue]) {
                TWDevice *device = [[[TWDevice alloc] init] autorelease];
    
                device.devicePath = [NSString stringWithFormat:@"%sr%@", _PATH_DEV, [properties valueForKey:@"BSD Name"]];
                device.blockSize = [[properties valueForKey:@"Preferred Block Size"] unsignedLongLongValue];
                device.writable = [[properties valueForKey:@"Writable"] boolValue];
                device.size = [[properties valueForKey:@"Size"] unsignedLongLongValue];
    
                io_name_t name;
                IORegistryEntryGetName(nextMedia, name);
                device.name = [NSString stringWithCString:name encoding:NSASCIIStringEncoding];
    
                …
    
                [detectedDevices addObject:device];
            }
    
            // tidy up
            IOObjectRelease(nextMedia);
            CFRelease(properties);
        }
        IOObjectRelease(mediaIterator);
    
        return detectedDevices;
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 295k
  • Answers 295k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your question has some ambiguities, so the following may not… May 13, 2026 at 6:47 pm
  • Editorial Team
    Editorial Team added an answer This has to do with the way that Active Record… May 13, 2026 at 6:47 pm
  • Editorial Team
    Editorial Team added an answer You might try a combination of VBox, collapsible panels and… May 13, 2026 at 6:47 pm

Related Questions

I'm currently writing a quick custom encoding method where I take a stamp a
I'm trying to display contextual help alongside form fields, that is only visible when
I need to cache some xml from a webservice to a local xml file
I am using ehCache to store larges amount of data. This cache is accessed
I am working on a program which includes a general purpose engine, some program

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.