Re: How to find memory size.

New Message Reply Date view Thread view Subject view Author view

From: Brian Furtaw (brian++at++sgi.com)
Date: 02/22/2000 09:51:07


Mark,

getinvent() database has an entry for memory size in MB so an int should
have plenty of room in it. Your searching the inventory for inv_class of
INV_MEMORY and inv_type of INV_MAIN_MB.

i.e
#include <invent.h>
#include <stdio.h>

main()
{
    inventory_t *pinv;
    
    setinvent();
    
    while(pinv = getinvent()) {
    
        if( pinv->inv_class == INV_MEMORY && (pinv->inv_type == INV_MAIN_MB) )
{
            printf("Main Memory size is %ld Mbytes", pinv->inv_state);
            if (pinv->inv_unit)
                printf(", %d-way interleaved\n", pinv->inv_unit);
            else
                printf("\n");
        }
      
    }
}

Brian

"Acosta, Mark W [Magic Earth LLC]" wrote:
>
> I know this is a bit off topic but it does involve a Performer program. I'm
> trying to programmatically determine the physical amount of memory on the
> machine I'm running on. The only thing I've found so far that does this is
> "getinvent()" which, unfortunately, only returns a 32 bit int with the
> memory size and I need this to work on machines with more than 2GB of
> memory. The man page for getinvent shows the return value (inv_state) as a
> long but the header file has it as an int. Anyone know of some other way to
> do this? Thanks.
>
> Mark Acosta
> Magic Earth LLC
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
    ----oOOo----    ----oOOo----    ----oOOo----    ----oOOo----

Brian Furtaw (brian++at++sgi.com) Graphics Guru Office:(301)572-3293 Fax: (301)572-3280 12200-G Plum Orchard Drive OpenGL/Performer/OpenInventor/ImageVision Silver Spring, Maryland 20904 Optimizer/React/PCI Device Drivers


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Feb 22 2000 - 10:24:14 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.