Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
25079419
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 搜索 >>
提交
25079419
编写于
9月 13, 2015
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the QuickLookplugin by adding hardware CPU info (issue #673)
上级
e068f419
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
2 deletion
+29
-2
NEWS
NEWS
+2
-1
glances/plugins/glances_quicklook.py
glances/plugins/glances_quicklook.py
+25
-0
setup.py
setup.py
+2
-1
未找到文件。
NEWS
浏览文件 @
25079419
...
...
@@ -11,8 +11,9 @@ Enhancements and new features:
* Docker plugin shows IO and network bitrate (issue #520)
* Server password configuration for the browser mode (issue #500)
* Add support for OpenTSDB export (issue #638)
*
Add additional stats (iowait, steal) to the perCPU plugin (issue #672)
* Add additional stats (iowait, steal) to the perCPU plugin (issue #672)
* Support Fahrenheit unit in the sensor plugin using the --fahrenheit command line option (issue #620)
* Improve the QuickLookplugin by adding hardware CPU info (issue #673)
* WebUI display a message if server is not available (issue #564)
* Display an error if export is not used in the standalone/client mode (issue #614)
* New --disable-quicklook, --disable-cpu, --disable-mem, --disable-swap, --disable-load tags (issue #631)
...
...
glances/plugins/glances_quicklook.py
浏览文件 @
25079419
...
...
@@ -25,6 +25,12 @@ from glances.plugins.glances_plugin import GlancesPlugin
from
glances.core.glances_logging
import
logger
import
psutil
try
:
from
cpuinfo
import
cpuinfo
except
ImportError
:
cpuinfo_tag
=
False
else
:
cpuinfo_tag
=
True
class
Plugin
(
GlancesPlugin
):
...
...
@@ -66,6 +72,14 @@ class Plugin(GlancesPlugin):
# Not available
pass
# Optionnaly, get the CPU name/frequency
# thanks to the cpuinfo lib: https://github.com/workhorsy/py-cpuinfo
if
cpuinfo_tag
:
cpu_info
=
cpuinfo
.
get_cpu_info
()
self
.
stats
[
'cpu_name'
]
=
cpu_info
[
'brand'
]
self
.
stats
[
'cpu_hz_current'
]
=
cpu_info
[
'hz_actual_raw'
][
0
]
self
.
stats
[
'cpu_hz'
]
=
cpu_info
[
'hz_advertised_raw'
][
0
]
# Update the view
self
.
update_views
()
...
...
@@ -95,6 +109,13 @@ class Plugin(GlancesPlugin):
bar
=
Bar
(
max_width
)
# Build the string message
if
'cpu_name'
in
self
.
stats
:
msg
=
'{0} - {1:.2f}/{2:.2f}GHz'
.
format
(
self
.
stats
[
'cpu_name'
],
self
.
_hz_to_ghz
(
self
.
stats
[
'cpu_hz_current'
]),
self
.
_hz_to_ghz
(
self
.
stats
[
'cpu_hz'
]))
if
len
(
msg
)
-
6
<=
max_width
:
ret
.
append
(
self
.
curse_add_line
(
msg
))
ret
.
append
(
self
.
curse_new_line
())
for
key
in
[
'cpu'
,
'mem'
,
'swap'
]:
if
key
==
'cpu'
and
args
.
percpu
:
for
cpu
in
self
.
stats
[
'percpu'
]:
...
...
@@ -129,3 +150,7 @@ class Plugin(GlancesPlugin):
# Return the message with decoration
return
ret
def
_hz_to_ghz
(
self
,
hz
):
"""Convert Hz to Ghz"""
return
hz
/
1000000000.0
setup.py
浏览文件 @
25079419
...
...
@@ -54,7 +54,8 @@ setup(
'RAID'
:
[
'pymdstat'
],
'DOCKER'
:
[
'docker-py'
],
'EXPORT'
:
[
'influxdb>=1.0.0'
,
'statsd'
,
'pika'
],
'ACTION'
:
[
'pystache'
]
'ACTION'
:
[
'pystache'
],
'CPUINFO'
:
[
'py-cpuinfo'
]
},
packages
=
[
'glances'
],
include_package_data
=
True
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录