Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
41781272
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,发现更多精彩内容 >>
提交
41781272
编写于
3月 22, 2014
作者:
N
Nicolas Hennion
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Client/server is working but not the monitored list
上级
3cbde4d2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
5 deletion
+52
-5
glances/core/glances_processes.py
glances/core/glances_processes.py
+6
-0
glances/plugins/glances_processcount.py
glances/plugins/glances_processcount.py
+5
-3
glances/plugins/glances_processlist.py
glances/plugins/glances_processlist.py
+41
-2
未找到文件。
glances/core/glances_processes.py
浏览文件 @
41781272
...
...
@@ -188,6 +188,12 @@ class glancesProcesses:
return
self
.
processcount
def
getlist
(
self
,
sortedby
=
None
):
"""
Return the processlist
"""
return
self
.
processlist
def
getsortlist
(
self
,
sortedby
=
None
):
"""
Return the processlist
"""
...
...
glances/plugins/glances_processcount.py
浏览文件 @
41781272
...
...
@@ -32,9 +32,6 @@ class Plugin(GlancesPlugin):
def
__init__
(
self
):
GlancesPlugin
.
__init__
(
self
)
# Nothing else to do...
# 'processes' is already init in the glances_processes.py script
# We want to display the stat in the curse interface
self
.
display_curse
=
True
# Set the message position
...
...
@@ -44,6 +41,8 @@ class Plugin(GlancesPlugin):
# Enter -1 to diplay bottom
self
.
line_curse
=
2
# Note: 'glances_processes' is already init in the glances_processes.py script
def
update
(
self
):
"""
Update processes stats
...
...
@@ -52,8 +51,11 @@ class Plugin(GlancesPlugin):
# Here, update is call for processcount AND processlist
glances_processes
.
update
()
# Return the processes count
self
.
stats
=
glances_processes
.
getcount
()
return
self
.
stats
def
msg_curse
(
self
,
args
=
None
):
"""
Return the dict to display in the curse interface
...
...
glances/plugins/glances_processlist.py
浏览文件 @
41781272
...
...
@@ -43,7 +43,7 @@ class Plugin(GlancesPlugin):
# Enter -1 to diplay bottom
self
.
line_curse
=
4
# Note
'processes' is already init in the
_processes.py script
# Note
: 'glances_processes' is already init in the glances
_processes.py script
def
update
(
self
):
"""
...
...
@@ -51,8 +51,11 @@ class Plugin(GlancesPlugin):
"""
# Note: Update is done in the processcount plugin
# Just return the processes list
self
.
stats
=
glances_processes
.
getlist
()
return
self
.
stats
def
msg_curse
(
self
,
args
=
None
):
"""
...
...
@@ -101,7 +104,7 @@ class Plugin(GlancesPlugin):
tag_proc_time
=
True
# Loop over processes (sorted by the sort key previously compute)
for
p
in
glances_processes
.
ge
tlist
(
process_sort_key
):
for
p
in
self
.
sor
tlist
(
process_sort_key
):
ret
.
append
(
self
.
curse_new_line
())
# Name
msg
=
"{0:15}"
.
format
(
p
[
'name'
][:
15
])
...
...
@@ -168,3 +171,39 @@ class Plugin(GlancesPlugin):
# Return the message with decoration
return
ret
def
sortlist
(
self
,
sortedby
=
None
):
"""
Return the self.stats sorted by sortedby
"""
if
(
sortedby
is
None
):
# No need to sort...
return
self
.
stats
sortedreverse
=
True
if
(
sortedby
==
'name'
):
sortedreverse
=
False
if
(
sortedby
==
'io_counters'
):
# Specific case for io_counters
# Sum of io_r + io_w
try
:
# Sort process by IO rate (sum IO read + IO write)
listsorted
=
sorted
(
self
.
stats
,
key
=
lambda
process
:
process
[
sortedby
][
0
]
-
process
[
sortedby
][
2
]
+
process
[
sortedby
][
1
]
-
process
[
sortedby
][
3
],
reverse
=
sortedreverse
)
except
Exception
:
listsorted
=
sorted
(
self
.
stats
,
key
=
lambda
process
:
process
[
'cpu_percent'
],
reverse
=
sortedreverse
)
else
:
# Others sorts
listsorted
=
sorted
(
self
.
stats
,
key
=
lambda
process
:
process
[
sortedby
],
reverse
=
sortedreverse
)
self
.
stats
=
listsorted
return
self
.
stats
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录