【发布时间】:2019-03-16 06:50:18
【问题描述】:
你怎么看:mnesia.info?
例如,我只有一张表 some_table,:mnesia.info 将这个返回给我。
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
some_table: with 16020 records occupying 433455 words of mem
schema : with 2 records occupying 536 words of mem
===> System info in version "4.15.5", debug level = none <===
opt_disc. Directory "/home/ubuntu/project/Mnesia.nonode@nohost" is NOT used.
use fallback at restart = false
running db nodes = [nonode@nohost]
stopped db nodes = []
master node tables = []
remote = []
ram_copies = ['some_table',schema]
disc_copies = []
disc_only_copies = []
[{nonode@nohost,ram_copies}] = [schema,'some_table']
488017 transactions committed, 0 aborted, 0 restarted, 0 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
也叫:
:mnesia.table_info("some_table", :size)
它返回 16020,我认为这是键的数量,但我怎样才能获得内存使用情况?
【问题讨论】:
-
根据the documentation,它是number of words,这意味着如果你在现代机器上,它是
16_020 * 64 / 8 = 128_160字节≈128K。 -
some_table: 16020条记录占用 433455 words of mem : 你要知道一个单词的大小你的机器(可能是 64 位,也可能是 32 位)
-
这个词是不是让我很困惑,不知道怎么知道它的大小