Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
274516f2
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,发现更多精彩内容 >>
提交
274516f2
编写于
2月 12, 2012
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ready for beta test
上级
2799eb83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
29 deletion
+8
-29
NEWS
NEWS
+1
-1
src/glances.py
src/glances.py
+7
-28
未找到文件。
NEWS
浏览文件 @
274516f2
Version 1.4
===========
*
No more StatGrab, w
elcome to the PsUtil library !
*
Goodby StatGrab... W
elcome to the PsUtil library !
* Sort by Process name ('p' key)
* Only major stats (CPU, Load and memory) use background colors
* Improve operating system name
...
...
src/glances.py
浏览文件 @
274516f2
...
...
@@ -34,12 +34,11 @@ try:
except
KeyboardInterrupt
:
pass
# i18n
#=====
application
=
'glances'
__version__
=
"1.4
a
"
__version__
=
"1.4
b
"
gettext
.
install
(
application
)
try
:
...
...
@@ -63,20 +62,12 @@ except:
print
sys
.
exit
(
1
)
# TODO: Remove after test PsUtil psutil.__version__
try
:
import
statgrab
except
:
print
_
(
'Statgrab initialization failed, Glances cannot start.'
)
print
sys
.
exit
(
1
)
try
:
import
curses
import
curses.panel
except
:
print
_
(
'Textmode GUI initialization failed, Glances cannot start.'
)
print
_
(
'Use Python 2.6 or higher'
)
print
sys
.
exit
(
1
)
...
...
@@ -275,18 +266,14 @@ class glancesGrabFs():
class
glancesStats
():
"""
This class store, update and give
the libstatgrab
stats
This class store, update and give stats
"""
def
__init__
(
self
):
"""
Init the
libstatgrab and process to the first update
Init the
stats
"""
# Init libstatgrab
if
not
statgrab
.
sg_init
():
print
_
(
"Error: Can not init the libstatgrab library.
\n
"
)
# Init the fs stats
try
:
self
.
glancesgrabfs
=
glancesGrabFs
()
...
...
@@ -298,8 +285,6 @@ class glancesStats():
"""
Update the stats
"""
# Get system informations
# Host and OS informations
self
.
host
=
{}
...
...
@@ -310,7 +295,7 @@ class glancesStats():
try
:
if
(
self
.
host
[
'os_name'
]
==
"Linux"
or
self
.
host
[
'os_name'
]
==
"FreeBSD"
):
os_version
=
platform
.
linux_distribution
()
self
.
host
[
'os_version'
]
=
os_version
[
0
]
+
" "
+
os_version
[
1
]
+
" ("
+
os_version
[
2
]
+
")"
self
.
host
[
'os_version'
]
=
os_version
[
0
]
+
" "
+
os_version
[
2
]
+
" "
+
os_version
[
1
]
elif
(
self
.
host
[
'os_name'
]
==
"Windows"
):
os_version
=
platform
.
win32_ver
()
self
.
host
[
'os_version'
]
=
os_version
[
0
]
+
" "
+
os_version
[
2
]
...
...
@@ -481,12 +466,7 @@ class glancesStats():
# Get the number of core (CPU) (Used to display load alerts)
self
.
core_number
=
psutil
.
NUM_CPUS
def
end
(
self
):
# Shutdown the libstatgrab
statgrab
.
sg_shutdown
()
def
update
(
self
):
# Update the stats
...
...
@@ -917,7 +897,7 @@ class glancesScreen():
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
if
((
screen_y
>
self
.
system_y
)
and
(
screen_x
>
self
.
system_x
+
79
)):
and
(
screen_x
>
self
.
system_x
+
79
)):
system_msg
=
system
[
'os_name'
]
+
" "
+
system
[
'platform'
]
+
" "
+
system
[
'os_version'
]
self
.
term_window
.
addnstr
(
self
.
system_y
,
self
.
system_x
+
int
(
screen_x
/
2
)
-
len
(
system_msg
)
/
2
,
system_msg
,
80
)
...
...
@@ -1332,7 +1312,6 @@ def main():
def
end
():
stats
.
end
()
screen
.
end
()
sys
.
exit
(
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录