Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
f811fb84
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,发现更多精彩内容 >>
提交
f811fb84
编写于
3月 28, 2014
作者:
N
Nicolas Hennion
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add enable/disable processes stats with z key
上级
c00f48d5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
65 addition
and
8 deletion
+65
-8
glances/core/glances_main.py
glances/core/glances_main.py
+2
-2
glances/core/glances_processes.py
glances/core/glances_processes.py
+30
-1
glances/outputs/glances_curses.py
glances/outputs/glances_curses.py
+10
-2
glances/plugins/glances_help.py
glances/plugins/glances_help.py
+1
-1
glances/plugins/glances_monitor.py
glances/plugins/glances_monitor.py
+2
-2
glances/plugins/glances_plugin.py
glances/plugins/glances_plugin.py
+4
-0
glances/plugins/glances_processcount.py
glances/plugins/glances_processcount.py
+12
-0
glances/plugins/glances_processlist.py
glances/plugins/glances_processlist.py
+4
-0
未找到文件。
glances/core/glances_main.py
浏览文件 @
f811fb84
...
...
@@ -49,7 +49,7 @@ class GlancesMain(object):
# hddtemp_flag = True
# network_tag = True
# sensors_tag = True
process_tag
=
True
#
process_tag = True
# Display property
use_bold
=
True
percpu_tag
=
False
...
...
@@ -206,7 +206,7 @@ class GlancesMain(object):
# self.fs_tag = args.disable_mount
# self.hddtemp_flag = args.disable_hddtemp
# self.network_tag = args.disable_network
self
.
process_tag
=
args
.
disable_process
#
self.process_tag = args.disable_process
# self.sensors_tag = args.disable_sensors and is_Linux # and sensors_lib_tag
self
.
use_bold
=
args
.
no_bold
self
.
percpu_tag
=
args
.
percpu
...
...
glances/core/glances_processes.py
浏览文件 @
f811fb84
...
...
@@ -39,18 +39,38 @@ class glancesProcesses:
# See: https://code.google.com/p/psutil/issues/detail?id=462
self
.
username_cache
=
{}
self
.
cmdline_cache
=
{}
# The internals caches will be cleaned each 'cache_timeout' seconds
self
.
cache_timeout
=
cache_timeout
self
.
cache_timer
=
Timer
(
self
.
cache_timeout
)
# Init the io dict
# key = pid
# value = [ read_bytes_old, write_bytes_old ]
self
.
io_old
=
{}
# Init
# Init stats
self
.
processsort
=
'cpu_percent'
self
.
processlist
=
[]
self
.
processcount
=
{
'total'
:
0
,
'running'
:
0
,
'sleeping'
:
0
,
'thread'
:
0
}
# Tag to enable/disable the processes stats (to reduce the Glances CPU comsumption)
# Default is to enable the processes stats
self
.
disable_tag
=
False
def
enable
(
self
):
"""
Enable process stats
"""
self
.
disable_tag
=
False
self
.
update
()
def
disable
(
self
):
"""
Enable process stats
"""
self
.
disable_tag
=
True
def
__get_process_stats
(
self
,
proc
):
"""
Get process statistics
...
...
@@ -139,9 +159,18 @@ class glancesProcesses:
return
procstat
def
update
(
self
):
"""
Update the processes sats
"""
# Reset the stats
self
.
processlist
=
[]
self
.
processcount
=
{
'total'
:
0
,
'running'
:
0
,
'sleeping'
:
0
,
'thread'
:
0
}
# Do not process if disable tag is set
if
(
self
.
disable_tag
):
return
# Get the time since last update
time_since_update
=
getTimeSinceLastUpdate
(
'process_disk'
)
...
...
glances/outputs/glances_curses.py
浏览文件 @
f811fb84
...
...
@@ -29,7 +29,7 @@ except ImportError:
# Import Glances lib
from
glances.core.glances_timer
import
Timer
from
glances.core.glances_globals
import
glances_logs
from
glances.core.glances_globals
import
glances_logs
,
glances_processes
class
glancesCurses
:
...
...
@@ -228,7 +228,15 @@ class glancesCurses:
elif
self
.
pressedkey
==
ord
(
'x'
):
# 'x' > Delete finished warning and critical logs
glances_logs
.
clean
(
critical
=
True
)
elif
self
.
pressedkey
==
ord
(
'z'
):
# 'z' > Enable/Disable processes stats (count + list + monitor)
# Enable/Disable display
self
.
args
.
disable_process
=
not
self
.
args
.
disable_process
# Enable/Disable update
if
(
self
.
args
.
disable_process
):
glances_processes
.
disable
()
else
:
glances_processes
.
enable
()
# Return the key code
return
self
.
pressedkey
...
...
glances/plugins/glances_help.py
浏览文件 @
f811fb84
...
...
@@ -113,7 +113,7 @@ class Plugin(GlancesPlugin):
ret
.
append
(
self
.
curse_new_line
())
msg
=
msg_col
.
format
(
_
(
"s"
),
_
(
"Show/hide sensors stats"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
msg
=
msg_col2
.
format
(
_
(
"z"
),
_
(
"
Disable all
processes stats"
))
msg
=
msg_col2
.
format
(
_
(
"z"
),
_
(
"
Enable/Disable
processes stats"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
ret
.
append
(
self
.
curse_new_line
())
msg
=
msg_col
.
format
(
_
(
"q"
),
_
(
"Quit (Esc and Ctrl-C also work)"
))
...
...
glances/plugins/glances_monitor.py
浏览文件 @
f811fb84
...
...
@@ -94,8 +94,8 @@ class Plugin(GlancesPlugin):
# Init the return message
ret
=
[]
#
Stats exist ?
if
(
self
.
stats
==
[]
):
#
Only process if stats exist and display plugin enable...
if
(
(
self
.
stats
==
[])
or
(
args
.
disable_process
)
):
return
ret
# Build the string message
...
...
glances/plugins/glances_plugin.py
浏览文件 @
f811fb84
...
...
@@ -17,6 +17,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
I am your father...
For all Glances plugins
"""
# Import system libs
import
json
...
...
glances/plugins/glances_processcount.py
浏览文件 @
f811fb84
...
...
@@ -65,6 +65,18 @@ class Plugin(GlancesPlugin):
# Init the return message
ret
=
[]
# Only process if stats exist and display plugin enable...
# if ((self.stats == {}) or (args.disable_process)):
# return ret
if
(
args
.
disable_process
):
msg
=
"{0} "
.
format
(
_
(
"PROCESSES DISABLED (press 'z' to display)"
))
ret
.
append
(
self
.
curse_add_line
(
msg
))
return
ret
if
(
self
.
stats
==
{}):
return
ret
# Build the string message
# Header
msg
=
"{0} "
.
format
(
_
(
"TASKS"
))
...
...
glances/plugins/glances_processlist.py
浏览文件 @
f811fb84
...
...
@@ -67,6 +67,10 @@ class Plugin(GlancesPlugin):
# Init the return message
ret
=
[]
# Only process if stats exist and display plugin enable...
if
((
self
.
stats
==
[])
or
(
args
.
disable_process
)):
return
ret
# Compute the sort key
if
(
args
.
process_sorted_by
==
'auto'
):
process_sort_key
=
glances_processes
.
getsortkey
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录