Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
0c40cc2c
G
glances
项目概览
蜕变的菜鸟
/
glances
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glances
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0c40cc2c
编写于
1月 17, 2015
作者:
N
Nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add view (MVC speeking) for the plugins. MEM and MEM SWAP OK.
上级
5496fcac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
10 deletion
+38
-10
glances/plugins/glances_mem.py
glances/plugins/glances_mem.py
+25
-9
glances/plugins/glances_memswap.py
glances/plugins/glances_memswap.py
+13
-1
未找到文件。
glances/plugins/glances_mem.py
浏览文件 @
0c40cc2c
...
...
@@ -155,8 +155,24 @@ class Plugin(GlancesPlugin):
# Update the history list
self
.
update_stats_history
()
# Update the view
self
.
update_views
()
return
self
.
stats
def
update_views
(
self
):
"""Update stats views"""
# Call the father's method
GlancesPlugin
.
update_views
(
self
)
# Add specifics informations
# Alert and log
self
.
views
[
'used'
][
'decoration'
]
=
self
.
get_alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
])
# Optional
for
key
in
[
'active'
,
'inactive'
,
'buffers'
,
'cached'
]:
if
key
in
self
.
stats
:
self
.
views
[
key
][
'optional'
]
=
True
def
msg_curse
(
self
,
args
=
None
):
"""Return the dict to display in the curse interface."""
# Init the return message
...
...
@@ -176,9 +192,9 @@ class Plugin(GlancesPlugin):
# Active memory usage
if
'active'
in
self
.
stats
:
msg
=
' {0:9}'
.
format
(
_
(
"active:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'active'
,
option
=
'optional'
)
))
msg
=
'{0:>7}'
.
format
(
self
.
auto_unit
(
self
.
stats
[
'active'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'active'
,
option
=
'optional'
)
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Total memory usage
...
...
@@ -189,9 +205,9 @@ class Plugin(GlancesPlugin):
# Inactive memory usage
if
'inactive'
in
self
.
stats
:
msg
=
' {0:9}'
.
format
(
_
(
"inactive:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'inactive'
,
option
=
'optional'
)
))
msg
=
'{0:>7}'
.
format
(
self
.
auto_unit
(
self
.
stats
[
'inactive'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'inactive'
,
option
=
'optional'
)
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Used memory usage
...
...
@@ -199,13 +215,13 @@ class Plugin(GlancesPlugin):
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
'{0:>7}'
.
format
(
self
.
auto_unit
(
self
.
stats
[
'used'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_
alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
]
)))
msg
,
self
.
get_
views
(
key
=
'used'
,
option
=
'decoration'
)))
# Buffers memory usage
if
'buffers'
in
self
.
stats
:
msg
=
' {0:9}'
.
format
(
_
(
"buffers:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'buffers'
,
option
=
'optional'
)
))
msg
=
'{0:>7}'
.
format
(
self
.
auto_unit
(
self
.
stats
[
'buffers'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'buffers'
,
option
=
'optional'
)
))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Free memory usage
...
...
@@ -216,8 +232,8 @@ class Plugin(GlancesPlugin):
# Cached memory usage
if
'cached'
in
self
.
stats
:
msg
=
' {0:9}'
.
format
(
_
(
"cached:"
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'cached'
,
option
=
'optional'
)
))
msg
=
'{0:>7}'
.
format
(
self
.
auto_unit
(
self
.
stats
[
'cached'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
True
))
ret
.
append
(
self
.
curse_add_line
(
msg
,
optional
=
self
.
get_views
(
key
=
'cached'
,
option
=
'optional'
)
))
return
ret
glances/plugins/glances_memswap.py
浏览文件 @
0c40cc2c
...
...
@@ -130,8 +130,20 @@ class Plugin(GlancesPlugin):
# Update the history list
self
.
update_stats_history
()
# Update the view
self
.
update_views
()
return
self
.
stats
def
update_views
(
self
):
"""Update stats views"""
# Call the father's method
GlancesPlugin
.
update_views
(
self
)
# Add specifics informations
# Alert and log
self
.
views
[
'used'
][
'decoration'
]
=
self
.
get_alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
])
def
msg_curse
(
self
,
args
=
None
):
"""Return the dict to display in the curse interface."""
# Init the return message
...
...
@@ -162,7 +174,7 @@ class Plugin(GlancesPlugin):
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
'{0:>6}'
.
format
(
self
.
auto_unit
(
self
.
stats
[
'used'
]))
ret
.
append
(
self
.
curse_add_line
(
msg
,
self
.
get_
alert_log
(
self
.
stats
[
'used'
],
max
=
self
.
stats
[
'total'
]
)))
msg
,
self
.
get_
views
(
key
=
'used'
,
option
=
'decoration'
)))
# New line
ret
.
append
(
self
.
curse_new_line
())
# Free memory usage
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录