Is there any way to identify the speed of your memory through software? I am on Fedora 9 and looking to find out the speed of the DIMM's I have in there currently.

I have tried a 'lshw' but it doesnt display the speed. I know the motherboard supports 3 different speeds, but I dont know whats in there and dont want to turn off the box.

Any ideas?

Thanks,

EDIT: I have found the ram to be '30 ns' according to dmidecode. How can it be 33 MHz if the board only supports 400, 533, 667 Mhz RAM?

EDIT 2: Are there any other tools to do this?



EDIT 3: I actually surrendered and ended up powering down for a few minutes and opening up the case. It turned out to be 667 MhZ - this model: http://www.directron.com/rm12864aa667.html. Despite not being able to actually figure out it was 667 through software, I have marked HD's answer as the correct one as that seems to be the best tool for the job.




Here is the output of demidecode --type memory

# dmidecode 2.7
SMBIOS 2.4 present.

Handle 0x0008, DMI type 5, 20 bytes.
Memory Controller Information
    Error Detecting Method: 64-bit ECC
    Error Correcting Capabilities:
    	None
    Supported Interleave: One-way Interleave
    Current Interleave: One-way Interleave
    Maximum Memory Module Size: 1024 MB
    Maximum Total Memory Size: 2048 MB
    Supported Speeds:
    	70 ns
    	60 ns
    	50 ns
    Supported Memory Types:
    	DIMM
    	SDRAM
    Memory Module Voltage: 3.3 V
    Associated Memory Slots: 2
    	0x0009
    	0x000A
    Enabled Error Correcting Capabilities:
    	None

Handle 0x0009, DMI type 6, 12 bytes.
Memory Module Information
    Socket Designation: DIMM0
    Bank Connections: 9 11
    Current Speed: 30 ns
    Type: Unknown FPM Parity SDRAM
    Installed Size: 1024 MB (Single-bank Connection)
    Enabled Size: 1024 MB (Single-bank Connection)
    Error Status: OK

Handle 0x000A, DMI type 6, 12 bytes.
Memory Module Information
    Socket Designation: DIMM1
    Bank Connections: 9 11
    Current Speed: 30 ns
    Type: Unknown FPM Parity SDRAM
    Installed Size: 1024 MB (Single-bank Connection)
    Enabled Size: 1024 MB (Single-bank Connection)
    Error Status: OK

Handle 0x002F, DMI type 16, 15 bytes.
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 4 GB
    Error Information Handle: Not Provided
    Number Of Devices: 2

Handle 0x0031, DMI type 17, 27 bytes.
Memory Device
    Array Handle: 0x002F
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM0
    Bank Locator: BANK0
    Type: SDRAM
    Type Detail: Synchronous
    Speed: Unknown
    Manufacturer: Manufacturer0
    Serial Number: SerNum0
    Asset Tag: AssetTagNum0
    Part Number: PartNum0

Handle 0x0033, DMI type 17, 27 bytes.
Memory Device
    Array Handle: 0x002F
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM1
    Bank Locator: BANK1
    Type: SDRAM
    Type Detail: Synchronous
    Speed: Unknown
    Manufacturer: Manufacturer1
    Serial Number: SerNum1
    Asset Tag: AssetTagNum1
    Part Number: PartNum1
link|improve this question

77% accept rate
feedback

10 Answers

up vote 10 down vote accepted
+100

dmidecode is the tool you're looking for.

link|improve this answer
There's lots of info here - but the speed is in ns, I want the speed in MHz? – barfoon Aug 6 '09 at 2:16
My dmidecode gives me speeds in ns and MHz, but a few seconds of arithmetic (or running units) will perform the conversion if necessary. – womble Aug 6 '09 at 2:19
So 30 ns memory = 33 MHz? Is my math correct there? 1 / (30 / 1,000,000) = speed in Hz – barfoon Aug 6 '09 at 2:32
2  
@barfoon: Yes, 30ns == 33MHz. The quicker calculation is 1000/(ns) == speed in MHz. – womble Aug 6 '09 at 4:47
show 2 more comments
feedback

On my Debian, lshw give me that information.

# lshw -version
B.02.13
# lshw -short -C memory
H/W path             Device     Class       Description
=======================================================
/0/1                            memory      128KiB BIOS
/0/5/6                          memory      20KiB L1 cache
/0/5/7                          memory      1MiB L2 cache
/0/27                           memory      System Memory
/0/27/0                         memory      256MiB DIMM DDR Synchronous 400 MHz (2.5 ns)
/0/27/1                         memory      256MiB DIMM DDR Synchronous 400 MHz (2.5 ns)
/0/27/2                         memory      256MiB DIMM DDR Synchronous 266 MHz (3.8 ns)
/0/27/3                         memory      256MiB DIMM DDR Synchronous 400 MHz (2.5 ns)
/0/28                           memory      Flash Memory
/0/28/0                         memory      512KiB Chip FLASH Non-volatile
/0/0                            memory      
/0/2                            memory
link|improve this answer
this is great, but on my version it does not show the speed under description. Thanks anyways, – barfoon Aug 6 '09 at 13:18
feedback

Can you post your output of dmidecode for the memory section? (dmidecode --type memory)

You might want to read this: http://www.howtoforge.com/dmidecode-finding-out-hardware-details-without-opening-the-computer-case

The "NS" references "nanosecond" the speed in which the memory is able to reply. The lower the number the faster the speed. Unfortunately this doesn't reference an exact Mhz number. DMIDECODE is supposed to output the Mhz as well. Check at the very bottom of the output or simply dmidecode --type memory | grep Mhz

link|improve this answer
Might I suggest that you upgrade your verision of dmidecode to 2.8 or later. You can grab the rpm here: icewalkers.com/rpm/dmidecode/fedora-core-9/download/… and just rpm -i dmidecode*rpm Ver. 2.7 doesn't support showing the Mhz at which your memory runs. – Dave Rickman Aug 11 '09 at 12:44
feedback

EDIT: I have found the ram to be '30 ns' according to dmidecode. How can it be 33 MHz if the board only supports 400, 533, 667 Mhz RAM?

I'm guessing it's something like this:

Each individual chip on a SIMM/DIMM runs at 30ns, or 33MHz. There are 8 chips per SIMM, so 8 x 33MHz = 266MHz; or 16 chips per DIMM, giving 533 MHz.

So while each chip runs at 33 MHz, the whole memory module can deliver data at 533 MHz.

link|improve this answer
I believe that this answer makes the most sense, ive posted the output of dmidecode above – barfoon Aug 10 '09 at 13:20
Unfortunately it's not that simple as i have seen such thing as reported speed being 30ns and actual memory speed being 667MHz... So i'm not certain tehre is a clear relationship between the two of them. – olefebvre Aug 11 '09 at 14:42
feedback

If you're really lucky, the tool you're looking for is a flashlight. Some memory you can open the case up and look and see a sticker that has it on the label. Depends entirely on your case though as to how easy it is to get to it, and you don't need to turn off the machine as long as you're really really REALLY careful. I don't know how experienced you are with working on machine internals, but this is the next thing I try when I can't use Linux software commands to figure it out.

link|improve this answer
feedback

If you really want to benchmark the speed of the memory, you can't do it in a 32bit processor 386 protected mode since the page faults and the layout of the pagetables will weight a lot in the results.

Your best bet is coding the benchmark in 16bit "real mode" where you have direct access to the memory physical addresses.

For a nice bootup code that can be easily customizable, check the GRUB bootloader stage1 source. stage1 is the MBR that resides in the first 512 bytes of your hard disk. You'll find it in the source directory stage1/stage1.S file; it's heavily commented and easily understandable.

Once you have the MBR customized to your needs, compile it using the following method:

$ BOOT=mbr
$ gcc -O2 -fno-builtin -nostdinc -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef -g -c $BOOT.S
$ gcc  -g  -nostdlib -Wl,-N,-Ttext,7C00 -o $BOOT.exec  $BOOT.o  
$ objcopy -O binary $BOOT.exec $BOOT

Now you have an x86 MBR ready. It's desirable to test your code on a virtual machine like Qemu or Bochs before running it on the real machine; it will also ease the compilation/debugging cycle.

Hope it helps

link|improve this answer
1  
I think he just wants to know what frequency his RAM is rated at without opening the machine. – MDMarra Aug 9 '09 at 13:15
feedback

What vendor is the machine from? You can't look it up on their site?

link|improve this answer
No, its a custom built machine – barfoon Aug 10 '09 at 13:22
feedback

If possible try running Memtest, IIRC it shows the troughout as well as the memory speed in the top left corner (20000MB/s @ 667MHz for instance).

link|improve this answer
feedback

I know this is a bit late, but:

If you take the supported timings, and halve them, they fit with the given rate of 30. Then if you halve this and divide 10000 by it, gives (800, 666, 571.4)

I have no idea why, although I thing the connection between timings and data-rate might be complicated; Also, one of these might be a double data rate.

link|improve this answer
feedback

following code will give all the details which your looking for u need to save as .py

!/usr/bin/env python

Try to determine how much RAM is currently being used per program.

Note per program, not per process. So for example this script

will report RAM used by all httpd process together. In detail it reports:

sum(private RAM for program processes) + sum(Shared RAM for program processes)

The shared RAM is problematic to calculate, and this script automatically

selects the most accurate method available for your kernel.

Author: rajatjpatel@gmail.com

Notes:

#

import sys, os, string

if os.geteuid() != 0: sys.stderr.write("Sorry, root permission required.\n"); sys.exit(1)

PAGESIZE=os.sysconf("SC_PAGE_SIZE")/1024 #KiB our_pid=os.getpid()

(major,minor,release)

def kernel_ver(): kv=open("/proc/sys/kernel/osrelease").readline().split(".")[:3] for char in "-_": kv[2]=kv[2].split(char)[0] return (int(kv[0]), int(kv[1]), int(kv[2]))

kv=kernel_ver()

have_pss=0

return Private,Shared

Note shared is always a subset of rss (trs is not always)

def getMemStats(pid): global have_pss Private_lines=[] Shared_lines=[] Pss_lines=[] Rss=int(open("/proc/"+str(pid)+"/statm").readline().split()[1])*PAGESIZE if os.path.exists("/proc/"+str(pid)+"/smaps"): #stat for line in open("/proc/"+str(pid)+"/smaps").readlines(): #open if line.startswith("Shared"): Shared_lines.append(line) elif line.startswith("Private"): Private_lines.append(line) elif line.startswith("Pss"): have_pss=1 Pss_lines.append(line) Shared=sum([int(line.split()[1]) for line in Shared_lines]) Private=sum([int(line.split()[1]) for line in Private_lines]) #Note Shared + Private = Rss above #The Rss in smaps includes video card mem etc. if have_pss: pss_adjust=0.5 #add 0.5KiB as this average error due to trunctation Pss=sum([float(line.split()[1])+pss_adjust for line in Pss_lines]) Shared = Pss - Private elif (2,6,1) <= kv <= (2,6,9): Shared=0 #lots of overestimation, but what can we do? Private = Rss else: Shared=int(open("/proc/"+str(pid)+"/statm").readline().split()[2]) Shared*=PAGESIZE Private = Rss - Shared return (Private, Shared)

def getCmdName(pid): cmd = file("/proc/%d/status" % pid).readline()[6:-1] exe = os.path.basename(os.path.realpath("/proc/%d/exe" % pid)) if exe.startswith(cmd): cmd=exe #show non truncated version #Note because we show the non truncated name #one can have separated programs as follows: #584.0 KiB + 1.0 MiB = 1.6 MiB mozilla-thunder (exe -> bash) # 56.0 MiB + 22.2 MiB = 78.2 MiB mozilla-thunderbird-bin return cmd

cmds={} shareds={} count={} for pid in os.listdir("/proc/"): try: pid = int(pid) #note Thread IDs not listed in /proc/ which is good if pid == our_pid: continue except: continue try: cmd = getCmdName(pid) except: #permission denied or #kernel threads don't have exe links or #process gone continue try: private, shared = getMemStats(pid) except: continue #process gone if shareds.get(cmd): if have_pss: #add shared portion of PSS together shareds[cmd]+=shared elif shareds[cmd] < shared: #just take largest shared val shareds[cmd]=shared else: shareds[cmd]=shared cmds[cmd]=cmds.setdefault(cmd,0)+private if count.has_key(cmd): count[cmd] += 1 else: count[cmd] = 1

Add shared mem for each program

total=0 for cmd in cmds.keys(): cmds[cmd]=cmds[cmd]+shareds[cmd] total+=cmds[cmd] #valid if PSS available

sort_list = cmds.items() sort_list.sort(lambda x,y:cmp(x[1],y[1])) sort_list=filter(lambda x:x[1],sort_list) #get rid of zero sized processes

The following matches "du -h" output

see also human.py

def human(num, power="Ki"): powers=["Ki","Mi","Gi","Ti"] while num >= 1000: #4 digits num /= 1024.0 power=powers[powers.index(power)+1] return "%.1f %s" % (num,power)

def cmd_with_count(cmd, count): if count>1: return "%s (%u)" % (cmd, count) else: return cmd

print " Private + Shared = RAM used\tProgram \n" for cmd in sort_list: print "%8sB + %8sB = %8sB\t%s" % (human(cmd[1]-shareds[cmd[0]]), human(shareds[cmd[0]]), human(cmd[1]), cmd_with_count(cmd[0], count[cmd[0]])) if have_pss: print "-" * 33 print " " * 24 + "%8sB" % human(total) print "=" * 33 print "\n Private + Shared = RAM used\tProgram \n"

Warn of possible inaccuracies

2 = accurate & can total

1 = accurate only considering each process in isolation

0 = some shared mem not reported

-1= all shared mem not reported

def shared_val_accuracy(): """http://wiki.apache.org/spamassassin/TopSharedMemoryBug""" if kv[:2] == (2,4): if open("/proc/meminfo").read().find("Inact_") == -1: return 1 return 0 elif kv[:2] == (2,6): if os.path.exists("/proc/"+str(os.getpid())+"/smaps"): if open("/proc/"+str(os.getpid())+"/smaps").read().find("Pss:")!=-1: return 2 else: return 1 if (2,6,1) <= kv <= (2,6,9): return -1 return 0 else: return 1

vm_accuracy = shared_val_accuracy() if vm_accuracy == -1: sys.stderr.write( "Warning: Shared memory is not reported by this system.\n" ) sys.stderr.write( "Values reported will be too large, and totals are not reported\n" ) elif vm_accuracy == 0: sys.stderr.write( "Warning: Shared memory is not reported accurately by this system.\n" ) sys.stderr.write( "Values reported could be too large, and totals are not reported\n" ) elif vm_accuracy == 1: sys.stderr.write( "Warning: Shared memory is slightly over-estimated by this system\n" "for each program, so totals are not reported.\n" )

By Rajat Patel http://chida.in

link|improve this answer
1  
Apart from not even attempting to format your code, you're answering the wrong question, "How much RAM is a program using?", not "How fast is my RAM?" – pgs Aug 10 '09 at 6:13
1  
-1 : this can't possibly work and it has nothing to do with the question. – onesysadmin Aug 10 '09 at 6:16
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.