Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add stat for jemalloc/osmem, with debug_console output sytle modify #1217

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fanlix
Copy link
Contributor

@fanlix fanlix commented Jul 21, 2020

stat: add mem stat for jemalloc/os

修改内容

  • 1, add opts arg for mallctl()
  • 2, collect jemalloc.mem info
  • 3, collect os.mem info by /proc
  • 4, add new debug_console cmd: jmem, osmem, i, q
  • 5, make mem/cmem/stat cmd more human-readable

debug_console指令

  • jmem/osmem指令, 显示jemalloc和对应的os的内存占用细节.
  • q 退出指令, 忘记烦人的telnet ^[, quit
  • 调整了mem/cmem等指令的输出格式, 更易阅读.

指令用例

jmem
<CMD: jmem>
---------------------------------
stats.active       14888960     14.20 Mb
stats.allocated    14265888     13.61 Mb
stats.mapped       42164224     40.21 Mb
stats.resident     18509824     17.65 Mb
stats.retained     16556032     15.79 Mb
<CMD OK> cost=0.0011 sec

osmem
<CMD: osmem>
---------------------------------
dat       158984 Kb    156 Mb
rss        16256 Kb     16 Mb
shr         1592 Kb      2 Mb
txt          964 Kb      1 Mb
vsz       165144 Kb    162 Mb
<CMD OK> cost=0.0002 sec

cmem
<CMD: cmem>
---------------------------------
:01000001               640      0.00 Mb
:01000002            182512      0.17 Mb
:01000003             47456      0.05 Mb
:01000004             68656      0.07 Mb
:01000005             99296      0.09 Mb
:01000006               144      0.00 Mb
:01000007             16208      0.02 Mb
:01000008             80880      0.08 Mb
:01000009            109648      0.10 Mb
:0100000a             19888      0.02 Mb
:0100000b             12672      0.01 Mb
:0100000c            149584      0.14 Mb
:0100000d             13328      0.01 Mb
:0100000e             15984      0.02 Mb
:0100000f             42320      0.04 Mb
:fffffffe                32      0.00 Mb
:ffffffff          10521008     10.03 Mb
block   6956
total   11380256  10.85 Mb
<CMD OK> cost=0.0004 sec

mem
<CMD: mem>
---------------------------------
:01000004             65.64      0.06 Mb  (snlua cmaster)
:01000005             70.80      0.07 Mb  (snlua cslave)
:01000007             51.27      0.05 Mb  (snlua datacenterd)
:01000008             58.38      0.06 Mb  (snlua service_mgr)
:0100000a            290.04      0.28 Mb  (snlua protoloader)
:0100000b             64.67      0.06 Mb  (snlua console)
:0100000c            103.17      0.10 Mb  (snlua debug_console 8000)
:0100000d             53.62      0.05 Mb  (snlua simpledb)
:0100000e             52.29      0.05 Mb  (snlua watchdog)
:0100000f             60.24      0.06 Mb  (snlua gate)
sum          870.11 Kb  0.85 Mb (sum)
<CMD OK> cost=0.0004 sec

q
Connection closed by foreign host.

fanlix and others added 3 commits January 3, 2020 10:03
1, add opts arg for mallctl()
2, collect jemalloc.mem info
3, collect os.mem info by /proc
4, add new debug_console cmd:  jmem, osmem, i, q
5, make mem/cmem/stat cmd more human-readable
@cloudwu
Copy link
Owner

cloudwu commented Jul 21, 2020

建议把针对 jemalloc memory hook 部分单独提一个 pr ,我可以先合并。
针对 console 的修改另外给一个,暂时不合并。

@fanlix
Copy link
Contributor Author

fanlix commented Jul 22, 2020

好的, 稍后拆分.

@fanlix fanlix changed the title add stat for jemalloc/osmem add stat for jemalloc/osmem, with debug_console output sytle modify Jul 22, 2020
@fanlix fanlix mentioned this pull request Jul 22, 2020
@fanlix
Copy link
Contributor Author

fanlix commented Jul 23, 2020

rebase master

now this PR only contains osmem/console-style modify

@cloudwu cloudwu force-pushed the master branch 2 times, most recently from 31e0ac2 to 208be03 Compare December 10, 2021 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants