Linux command – Memtester

Loading

之前用過 Memtest86+ https://benjr.tw/491 ,無法直接在 Linux 環境下直接來使用,Memtester 可以直接在 Linux 環境下執行,且可以從 apt-get 下載使用,官方網站 http://pyropus.ca/software/memtester/

root@ubuntu:~# apt-get install memtester
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
  linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  memtester
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 16.2 kB of archives.
After this operation, 66.6 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 memtester amd64 4.3.0-3 [16.2 kB]
Fetched 16.2 kB in 1s (11.6 kB/s)                      
Selecting previously unselected package memtester.
(Reading database ... 242316 files and directories currently installed.)
Preparing to unpack .../memtester_4.3.0-3_amd64.deb ...
Unpacking memtester (4.3.0-3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up memtester (4.3.0-3) ...

使用上也很簡單,只需要指定要測試的記憶體大小 (單位: B/K/M/G) 以及測試次數 (Loops) 即可.

Usage: memtester [-p physaddrbase [-d device]] <mem>[B|K|M|G] [loops]

我的系統是 Ubuntu16.04 1G 記憶體 的 VMware 虛擬機器.

root@ubuntu:~# memtester 200M 1
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 200MB (209715200 bytes)
got  200MB (209715200 bytes), trying mlock ...locked.
Loop 1/1:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Done.

Memtester 主要會針對記憶體做以下的測試

  1. Stuck Address
  2. Random Value -test random value
  3. Compare XOR – test xor comparison
  4. Compare SUB – test sub comparison
  5. Compare MUL – test mul comparison
  6. Compare DIV – test div comparison
  7. Compare OR – test or comparison
  8. Compare AND – test and comparison
  9. Sequential Increment – test seqinc comparison
  10. Solid Bits – test solidbits comparison
  11. Block Sequential – test blockseq comparison
  12. Checkerboard – test checkerboard comparison
  13. Bit Spread – test bitspread comparison
  14. Bit Flip – test bitflip comparison
  15. Walking Ones – test walk bits 1 comparison
  16. Walking Zeroes – test_walk bits 0 comparison
  17. 8-bit Writes – test 8bit wide random
  18. 16-bit Writes -test 16bit wide random

memtester 是透過 malloc 函數來要求記憶體空間,所以在設定測試記憶體空間時沒有辦法把全部的記憶體都拿來測試.

root@ubuntu:~# free
              total        used        free      shared  buff/cache   available
Mem:         998312      158264      740632          80       99416      698696
Swap:       1046524      492832      553692

透過 free 可以看到,系統大概還有 700M 可以用,所以上限大概也就在這裡.
Linux 底下記憶體的使用區分下面幾種.

  • Total Memory
    系統所有的記憶體容量.
  • Used Memory
    Total(998,312) – Free(740632) – Buffers/Cache(99416) 就是目前所有有在使用中的記憶體數量.
  • Free Memory
    尚未使用到的的記憶體.
  • shared Memory
    used by tmpfs , 允許 processes (程序) 透過 Shared memory 共享儲存於記憶體中的 common structures 和 Data.
  • Buffered Memory
    資料還來不及儲存到硬碟中暫儲在記憶體的資料.
  • Cached Memory
    資料已經由硬碟中讀取出來,提供給應用程式接下來使用,用以提高存取效能.
  • Available
    估計有多少記憶體可用於啟動新應用程式,無需透過 swapping

超過系統能給的時候 memtester 就不會繼續執行.

root@ubuntu:~# memtester 1G 1
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 1024MB (1073741824 bytes)
got  1024MB (1073741824 bytes), trying mlock ...Killed
root@ubuntu:~# memtester 700M 1
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 700MB (734003200 bytes)
got  700MB (734003200 bytes), trying mlock ...locked.
Loop 1/1:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : setting  99Killed
沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料