Re: How can I determine ram in C ?
From: Walter Roberson (roberson_at_ibd.nrc-cnrc.gc.ca)
Date: 08/29/03
- Previous message: Dr. David Kirkby: "How can I determine ram in C ?"
- In reply to: Dr. David Kirkby: "How can I determine ram in C ?"
- Next in thread: Dr. David Kirkby: "Re: How can I determine ram in C ?"
- Reply: Dr. David Kirkby: "Re: How can I determine ram in C ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Aug 2003 02:44:44 GMT
In article <3F4EADAC.FE64635F@ntlworld.com>,
Dr. David Kirkby <drkirkby@ntlworld.com> wrote:
:I know the hinv command gives a lot of information about a machine,
:but is there a way to get the same information in C ?
Yes.
:I can get the
:number of CPUs online using sysconf, but I can't find a way to get the
:ram.
getinvent() and go through the returned table looking for inv_class == 3:
those represent memory of various kind. Look then at inv_type
for the kind of memory: main memory is type 9. The inv_state for that
entry is the size of main memory in megabytes.
:Other information, such as CPU, FPU, cache sizes would be useful
:too.
Within inv_class 3, use this table:
inv_type # type inv_state is in hinv prints as
3 DCACHE bytes Kb
4 ICACHE bytes Kb
6 SDCACHE bytes bytes
7 SICACHE bytes bytes
8 SIDCACHE bytes Mb
I wrote some table-driven code in the IRIX 6.2 timeframe to decode
inventories; it was an extension to some MO (magento-optical) handling
tools that I wrote that had to be able to search the inventory to
figure out where the drives were and then runs SCSI senses on
them to figure out what kinds of drives they were. If you write me
in your medphys University incarnation, I can make the source available
to you for research purposes.
-- Perposterous!! Where would all the calculators go?!
- Previous message: Dr. David Kirkby: "How can I determine ram in C ?"
- In reply to: Dr. David Kirkby: "How can I determine ram in C ?"
- Next in thread: Dr. David Kirkby: "Re: How can I determine ram in C ?"
- Reply: Dr. David Kirkby: "Re: How can I determine ram in C ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|