Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
1d276d1f
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,发现更多精彩内容 >>
提交
1d276d1f
编写于
12月 25, 2011
作者:
N
nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
version 1.3.4
上级
6088b3d8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
91 addition
and
480 deletion
+91
-480
NEWS
NEWS
+9
-0
README
README
+6
-3
README-fr
README-fr
+7
-4
README.md
README.md
+1
-217
README.md
README.md
+1
-217
man/glances.1
man/glances.1
+7
-1
screenshot.png
screenshot.png
+0
-0
setup.py
setup.py
+2
-2
src/glances.py
src/glances.py
+58
-36
未找到文件。
NEWS
浏览文件 @
1d276d1f
Version 1.3.4
=============
* New key: 'n' to enable/disable network stats
* New key: 'd' to enable/disable disk IO stats
* New key: 'f' to enable/disable FS stats
* Reorganised the screen when stat are not available|disable
* Force Glances to use the enmbeded fs stats (issue #16)
Version 1.3.3
=============
...
...
README
浏览文件 @
1d276d1f
...
...
@@ -20,12 +20,12 @@ Packages exist for Arch, Fedora, Redhat ...
Get the latest version:
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.
3
.tar.gz
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.
4
.tar.gz
Glances use a standard GNU style installer:
$ tar zxvf glances-1.3.
3
.tar.gz
$ cd glances-1.3.
3
$ tar zxvf glances-1.3.
4
.tar.gz
$ cd glances-1.3.
4
$ ./configure
$ make
$ sudo make install
...
...
@@ -79,7 +79,10 @@ When Glances is running, you can press:
If MEM > 70%, sort by process "memory size"
* 'c' to sort the processes list by CPU consumption
* 'd' Disable or enable the disk IO stats
* 'f' Disable or enable the file system stats
* 'm' to sort the processes list by process size
* 'n' Disable or enable the network interfaces stats
* 'q' Exit
### Header
...
...
README-fr
浏览文件 @
1d276d1f
...
...
@@ -27,14 +27,14 @@ Le projet Glances est hébergé sur GitHUB: https://github.com/nicolargo/glances
Pour l'installer, il suffit de suivre les instructions suivantes depuis un
terminal.
Récupération de la dernière version (1.3.
3
):
Récupération de la dernière version (1.3.
4
):
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.
3
.tar.gz
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.
4
.tar.gz
Procédez ensuite à l'installation:
$ tar zxvf glances-1.3.
3
.tar.gz
$ cd glances-1.3.
3
$ tar zxvf glances-1.3.
4
.tar.gz
$ cd glances-1.3.
4
$ ./configure
$ make
$ sudo make install
...
...
@@ -102,7 +102,10 @@ Quand Glances est lancé, il est possible d'utiliser les touches suivantes:
si la mémoire total > 70% alors le tri se fait pas consommation MEMOIRE
* 'c' pour forcer le tri par consommation CPU
* 'd' pour desactiver ou activer l'affichage des entrées/sorties disques
* 'f' pour desactiver ou activer l'affichage de l'occupation des FS
* 'm' pour forcer le tri par consommation MEMOIRE
* 'n' pour desactiver ou activer l'affichage des interfaces réseau
* 'q' sortir de Glances (il est également possible d'utiliser CTRL-C)
Passons ensuite à la description de la fenêtre de Glances:
...
...
README.md
已删除
100644 → 0
浏览文件 @
6088b3d8
Glances -- Eye on your system
=============================
## Description
Glances is a CLI curses based monitoring tool for GNU/Linux or BSD OS.
Glances uses the libstatgrab library to get information from your system.
It is developed in Python and uses the python-statgrab lib.
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/screenshot.png
)
## Installation
### From package manager
Packages exist for Arch, Fedora, Redhat ...
### From source
Get the latest version:
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.3.tar.gz
Glances use a standard GNU style installer:
$ tar zxvf glances-1.3.3.tar.gz
$ cd glances-1.3.3
$ ./configure
$ make
$ sudo make install
Pre-requisites:
*
Python 2.6+ (not tested with Python 3+)
*
python-statgrab 0.5+ (did NOT work with python-statgrab 0.4)
Notes: For Debian.
The Debian Squeeze repos only include the python-statgrab 0.4.
You had to install the version 0.5 using the following commands:
$ sudo apt-get install libstatgrab-dev pkg-config python-dev make
$ wget http://ftp.uk.i-scream.org/sites/ftp.i-scream.org/pub/i-scream/pystatgrab/pystatgrab-0.5.tar.gz
$ tar zxvf pystatgrab-0.5.tar.gz
$ cd pystatgrab-0.5/
$ ./setup.py build
$ sudo ./setup.py install
Notes: For Ubuntu 10.04 and 10.10.
The instruction to install the version 0.5 are here:
https://github.com/nicolargo/glances/issues/5#issuecomment-3033194
## Running
Easy:
$ glances.py
## User guide
By default, stats are refreshed every second, to change this setting, you can
use the -t option. For exemple to set the refrech rate to 5 seconds:
$ glances.py -t 5
Importants stats are colored:
*
GREEN: stat counter is "OK"
*
BLUE: stat counter is "CAREFUL"
*
MAGENTA: stat counter is "WARNING"
*
RED: stat counter is "CRITICAL"
When Glances is running, you can press:
*
'a' to set the automatic mode. The processes are sorted automatically
If CPU > 70%, sort by process "CPU consumption"
If MEM > 70%, sort by process "memory size"
*
'c' to sort the processes list by CPU consumption
*
'm' to sort the processes list by process size
*
'q' Exit
### Header
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/header.png
)
The header shows the Glances version, the host name and the operating
system name, version and architecture.
### CPU
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/cpu.png
)
The CPU states are shown as a percentage and for the configured refresh
time.
If user|kernel|nice CPU is < 50%, then status is set to "OK".
If user|kernel|nice CPU is > 50%, then status is set to "CAREFUL".
If user|kernel|nice CPU is > 70%, then status is set to "WARNING".
If user|kernel|nice CPU is > 90%, then status is set to "CRITICAL".
### Load
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/load.png
)
On the Nosheep blog, Zach defines the average load: "In short it is the
average sum of the number of processes waiting in the run-queue plus the
number currently executing over 1, 5, and 15 minute time periods."
Glances gets the number of CPU cores to adapt the alerts. With Glances,
alerts on average load are only set on 5 and 15 mins.
If average load is < O.7
*
Core, then status is set to "OK".
If average load is > O.7
*
Core, then status is set to "CAREFUL".
If average load is > 1
*
Core, then status is set to "WARNING".
If average load is > 5
*
Core, then status is set to "CRITICAL".
### Memory
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/mem.png
)
Glances uses tree columns: memory (RAM), swap and "real".
Real used memory is: used - cache.
Real free memory is: free + cache.
With Glances, alerts are only set for on used swap and real memory.
If memory is < 50%, then status is set to "OK".
If memory is > 50%, then status is set to "CAREFUL".
If memory is > 70%, then status is set to "WARNING".
If memory is > 90%, then status is set to "CRITICAL".
### Network bit rate
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/network.png
)
Glances display the network interface bit rate. The unit is adapted
dynamicaly (bits per second, Kbits per second, Mbits per second...).
Alerts are set only if the network interface maximum speed is available.
If bitrate is < 50%, then status is set to "OK".
If bitrate is > 50%, then status is set to "CAREFUL".
If bitrate is > 70%, then status is set to "WARNING".
If bitrate is > 90%, then status is set to "CRITICAL".
For exemple, on a 100 Mbps Ethernet interface, the warning status is set
if the bit rate is higher than 70 Mbps.
### Disk I/O
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/diskio.png
)
Glances display the disk I/O throughput. The unit is adapted dynamicaly
(bytes per second, Kbytes per second, Mbytes per second...).
There is no alert on this information.
### Filesystem
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/fs.png
)
Glances display the total and used filesytem disk space. The unit is
adapted dynamicaly (bytes per second, Kbytes per second, Mbytes per
second...).
Alerts are set for used disk space:
If disk used is < 50%, then status is set to "OK".
If disk used is > 50%, then status is set to "CAREFUL".
If disk used is > 70%, then status is set to "WARNING".
If disk used is > 90%, then status is set to "CRITICAL".
### Processes
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/processlist.png
)
Glances displays a summary and a list of processes.
By default (or if you hit the 'a' key) the process list is automaticaly
sorted by CPU of memory consumption.
The number of processes in the list is adapted to the screen size.
### Footer
![
screenshot
](
https://github.com/nicolargo/glances/raw/master/doc/footer.png
)
Glances displays a caption and the current time/date.
## Todo
You are welcome to contribute to this software.
*
Packaging for Debian, Ubuntu, BSD...
*
Check the needed Python library in the configure.ac
*
Add file system stats when the python-statgrab is corrected
*
Add a user guide window
README.md
0 → 120000
浏览文件 @
1d276d1f
README
\ No newline at end of file
man/glances.1
浏览文件 @
1d276d1f
.TH glances 1 "December
13, 2011" "version 0.1
" "USER COMMANDS"
.TH glances 1 "December
25, 2011" "version 1.3.4
" "USER COMMANDS"
.SH NAME
glances \- CLI curses based monitoring tool
.SH SYNOPSIS
...
...
@@ -16,8 +16,14 @@ You can use the following keys to sort the processesi list:
'a' to set the automatic mode. The process list is sorted automatically
.PP
'c' the processes list is sorted by CPU consomption
.PP
'd' Disable or enable the disk IO stats
.PP
'f' Disable or enable the file system stats
.PP
'm' the processes list is sorted by process size
.PP
'n' Disable or enable the network interfaces stats
.PP
'q' Exit
.PP
...
...
screenshot.png
查看替换文件 @
6088b3d8
浏览文件 @
1d276d1f
83.0 KB
|
W:
|
H:
81.0 KB
|
W:
|
H:
2-up
Swipe
Onion skin
setup.py
浏览文件 @
1d276d1f
...
...
@@ -11,8 +11,8 @@ def read(fname):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
fname
)).
read
()
setup
(
name
=
'Glances'
,
version
=
'1.3.
3
'
,
download_url
=
'https://github.com/downloads/nicolargo/glances/glances-1.3.
3
.tar.gz'
,
version
=
'1.3.
4
'
,
download_url
=
'https://github.com/downloads/nicolargo/glances/glances-1.3.
4
.tar.gz'
,
url
=
'https://github.com/nicolargo/glances'
,
description
=
'CLI curses-based monitoring tool'
,
author
=
'Nicolas Hennion'
,
...
...
src/glances.py
浏览文件 @
1d276d1f
...
...
@@ -34,7 +34,7 @@ import multiprocessing
#==================
# The glances version id
__version__
=
"1.3.
3
"
__version__
=
"1.3.
4
"
# Class
#======
...
...
@@ -170,10 +170,10 @@ class glancesStats():
except
:
self
.
diskio
=
{}
try
:
self
.
fs
=
statgrab
.
sg_get_fs_stats
()
except
:
# Replace the bugged self.fs = statgrab.sg_get_fs_stats()
self
.
fs
=
self
.
glancesgrabfs
.
get
()
except
:
self
.
fs
=
{}
try
:
self
.
processcount
=
statgrab
.
sg_get_process_count
()
except
:
...
...
@@ -325,6 +325,11 @@ class glancesScreen():
self
.
if70pc_color
=
curses
.
color_pair
(
5
)
|
curses
.
A_BOLD
self
.
if90pc_color
=
curses
.
color_pair
(
2
)
|
curses
.
A_BOLD
# By default all the stats are displayed
self
.
network_tag
=
True
self
.
diskio_tag
=
True
self
.
fs_tag
=
True
# Init window
self
.
term_window
=
self
.
screen
.
subwin
(
0
,
0
)
...
...
@@ -441,9 +446,18 @@ class glancesScreen():
elif
(
self
.
pressedkey
==
99
):
# 'c' > Sort process list by Cpu usage
self
.
setProcessSortedBy
(
'cpu_percent'
)
elif
(
self
.
pressedkey
==
100
):
# 'n' > Enable/Disable diskio stats
self
.
diskio_tag
=
not
self
.
diskio_tag
elif
(
self
.
pressedkey
==
102
):
# 'n' > Enable/Disable fs stats
self
.
fs_tag
=
not
self
.
fs_tag
elif
(
self
.
pressedkey
==
109
):
# 'm' > Sort process list by Mem usage
self
.
setProcessSortedBy
(
'proc_size'
)
elif
(
self
.
pressedkey
==
110
):
# 'n' > Enable/Disable network stats
self
.
network_tag
=
not
self
.
network_tag
# Return the key code
return
self
.
pressedkey
...
...
@@ -463,8 +477,8 @@ class glancesScreen():
screen
.
displayLoad
(
stats
.
getLoad
(),
stats
.
getCore
())
screen
.
displayMem
(
stats
.
getMem
(),
stats
.
getMemSwap
())
network_count
=
screen
.
displayNetwork
(
stats
.
getNetwork
(),
stats
.
getNetworkInterface
())
diskio_count
=
screen
.
displayDiskIO
(
stats
.
getDiskIO
(),
self
.
network_y
+
network_count
+
3
)
screen
.
displayFs
(
stats
.
getFs
(),
self
.
network_y
+
network_count
+
diskio_count
+
6
)
diskio_count
=
screen
.
displayDiskIO
(
stats
.
getDiskIO
(),
self
.
network_y
+
network_count
)
screen
.
displayFs
(
stats
.
getFs
(),
self
.
network_y
+
network_count
+
diskio_count
)
screen
.
displayProcess
(
stats
.
getProcessCount
(),
stats
.
getProcessList
(
screen
.
getProcessSortedBy
()))
screen
.
displayCaption
()
screen
.
displayNow
(
stats
.
getNow
())
...
...
@@ -502,7 +516,7 @@ class glancesScreen():
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
if
((
screen_y
>
self
.
host_y
)
and
(
screen_x
>
self
.
host_x
+
79
)):
host_msg
=
"Glances v"
+
self
.
__version
+
" running on "
+
host
[
'hostname'
]
#+" "+str(pressed_key)
host_msg
=
"Glances v"
+
self
.
__version
+
" running on "
+
host
[
'hostname'
]
+
" "
+
str
(
self
.
pressedkey
)
self
.
term_window
.
addnstr
(
self
.
host_y
,
self
.
host_x
+
int
(
screen_x
/
2
)
-
len
(
host_msg
)
/
2
,
host_msg
,
80
,
self
.
title_color
if
self
.
hascolors
else
0
)
...
...
@@ -588,11 +602,11 @@ class glancesScreen():
Return the number of interfaces
"""
# Network interfaces bitrate
if
(
not
network
or
not
networkinterface
):
if
(
not
network
or
not
networkinterface
or
not
self
.
network_tag
):
return
0
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
if
((
screen_y
>
self
.
network_y
+
len
(
network
)
+
2
)
if
((
screen_y
>
self
.
network_y
+
3
)
and
(
screen_x
>
self
.
network_x
+
28
)):
# Get the speed of the network interface
# TODO: optimize...
...
...
@@ -613,18 +627,18 @@ class glancesScreen():
self
.
term_window
.
addnstr
(
self
.
network_y
+
1
+
i
,
self
.
network_x
,
network
[
i
][
'interface_name'
]
+
':'
,
8
)
self
.
term_window
.
addnstr
(
self
.
network_y
+
1
+
i
,
self
.
network_x
+
10
,
self
.
__autoUnit
(
network
[
i
][
'rx'
]
/
elapsed_time
*
8
)
+
"b"
,
8
,
self
.
__getColor
(
network
[
i
][
'rx'
]
/
elapsed_time
*
8
,
speed
[
network
[
i
][
'interface_name'
]]))
self
.
term_window
.
addnstr
(
self
.
network_y
+
1
+
i
,
self
.
network_x
+
20
,
self
.
__autoUnit
(
network
[
i
][
'tx'
]
/
elapsed_time
*
8
)
+
"b"
,
8
,
self
.
__getColor
(
network
[
i
][
'tx'
]
/
elapsed_time
*
8
,
speed
[
network
[
i
][
'interface_name'
]]))
return
i
return
i
+
3
return
0
def
displayDiskIO
(
self
,
diskio
,
offset_y
=
0
):
# Disk input/output rate
if
(
not
diskio
):
if
(
not
diskio
or
not
self
.
diskio_tag
):
return
0
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
self
.
diskio_y
=
offset_y
if
((
screen_y
>
self
.
diskio_y
+
len
(
diskio
)
+
2
)
if
((
screen_y
>
self
.
diskio_y
+
3
)
and
(
screen_x
>
self
.
diskio_x
+
28
)):
self
.
term_window
.
addnstr
(
self
.
diskio_y
,
self
.
diskio_x
,
"Disk I/O"
,
8
,
self
.
title_color
if
self
.
hascolors
else
curses
.
A_UNDERLINE
)
self
.
term_window
.
addnstr
(
self
.
diskio_y
,
self
.
diskio_x
+
10
,
"In/ps"
,
8
)
...
...
@@ -636,18 +650,18 @@ class glancesScreen():
self
.
term_window
.
addnstr
(
self
.
diskio_y
+
1
+
disk
,
self
.
diskio_x
,
diskio
[
disk
][
'disk_name'
]
+
':'
,
8
)
self
.
term_window
.
addnstr
(
self
.
diskio_y
+
1
+
disk
,
self
.
diskio_x
+
10
,
self
.
__autoUnit
(
diskio
[
disk
][
'write_bytes'
]
/
elapsed_time
)
+
"B"
,
8
)
self
.
term_window
.
addnstr
(
self
.
diskio_y
+
1
+
disk
,
self
.
diskio_x
+
20
,
self
.
__autoUnit
(
diskio
[
disk
][
'read_bytes'
]
/
elapsed_time
)
+
"B"
,
8
)
return
disk
return
disk
+
3
return
0
def
displayFs
(
self
,
fs
,
offset_y
=
0
):
# Filesystem stats
if
(
not
fs
):
if
(
not
fs
or
not
self
.
fs_tag
):
return
0
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
self
.
fs_y
=
offset_y
if
((
screen_y
>
self
.
fs_y
+
len
(
fs
)
+
2
)
if
((
screen_y
>
self
.
fs_y
+
3
)
and
(
screen_x
>
self
.
fs_x
+
28
)):
self
.
term_window
.
addnstr
(
self
.
fs_y
,
self
.
fs_x
,
"Mount"
,
8
,
self
.
title_color
if
self
.
hascolors
else
curses
.
A_UNDERLINE
)
self
.
term_window
.
addnstr
(
self
.
fs_y
,
self
.
fs_x
+
10
,
"Total"
,
8
)
...
...
@@ -658,7 +672,7 @@ class glancesScreen():
self
.
term_window
.
addnstr
(
self
.
fs_y
+
1
+
mounted
,
self
.
fs_x
,
fs
[
mounted
][
'mnt_point'
],
8
)
self
.
term_window
.
addnstr
(
self
.
fs_y
+
1
+
mounted
,
self
.
fs_x
+
10
,
self
.
__autoUnit
(
fs
[
mounted
][
'size'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
fs_y
+
1
+
mounted
,
self
.
fs_x
+
20
,
self
.
__autoUnit
(
fs
[
mounted
][
'used'
]),
8
,
self
.
__getColor
(
fs
[
mounted
][
'used'
],
fs
[
mounted
][
'size'
]))
return
mounted
return
mounted
+
3
return
0
...
...
@@ -668,46 +682,54 @@ class glancesScreen():
return
0
screen_x
=
self
.
screen
.
getmaxyx
()[
1
]
screen_y
=
self
.
screen
.
getmaxyx
()[
0
]
# If there is no (network&diskio&fs) stats
# then increase process window
if
(
not
self
.
network_tag
and
not
self
.
diskio_tag
and
not
self
.
fs_tag
):
process_x
=
0
else
:
process_x
=
self
.
process_x
# Display the process summary
if
((
screen_y
>
self
.
process_y
+
3
)
and
(
screen_x
>
self
.
process_x
+
48
)):
and
(
screen_x
>
process_x
+
48
)):
# Processes sumary
self
.
term_window
.
addnstr
(
self
.
process_y
,
self
.
process_x
,
"Process"
,
8
,
self
.
title_color
if
self
.
hascolors
else
curses
.
A_UNDERLINE
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
self
.
process_x
+
10
,
"Total"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
self
.
process_x
+
20
,
"Running"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
self
.
process_x
+
30
,
"Sleeping"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
self
.
process_x
+
40
,
"Other"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
self
.
process_x
,
"Number:"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
self
.
process_x
+
10
,
str
(
processcount
[
'total'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
self
.
process_x
+
20
,
str
(
processcount
[
'running'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
self
.
process_x
+
30
,
str
(
processcount
[
'sleeping'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
self
.
process_x
+
40
,
str
(
processcount
[
'stopped'
]
+
stats
.
getProcessCount
()[
'zombie'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
process_x
,
"Process"
,
8
,
self
.
title_color
if
self
.
hascolors
else
curses
.
A_UNDERLINE
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
process_x
+
10
,
"Total"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
process_x
+
20
,
"Running"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
process_x
+
30
,
"Sleeping"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
,
process_x
+
40
,
"Other"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
process_x
,
"Number:"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
process_x
+
10
,
str
(
processcount
[
'total'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
process_x
+
20
,
str
(
processcount
[
'running'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
process_x
+
30
,
str
(
processcount
[
'sleeping'
]),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
1
,
process_x
+
40
,
str
(
processcount
[
'stopped'
]
+
stats
.
getProcessCount
()[
'zombie'
]),
8
)
# Display the process detail
if
((
screen_y
>
self
.
process_y
+
6
)
and
(
screen_x
>
self
.
process_x
+
49
)):
and
(
screen_x
>
process_x
+
49
)):
# Processes detail
if
(
self
.
getProcessSortedBy
()
==
'cpu_percent'
):
sortchar
=
'^'
else
:
sortchar
=
' '
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
self
.
process_x
,
"Cpu %"
+
sortchar
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
process_x
,
"Cpu %"
+
sortchar
,
8
)
if
(
self
.
getProcessSortedBy
()
==
'proc_size'
):
sortchar
=
'^'
else
:
sortchar
=
' '
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
self
.
process_x
+
10
,
"Size MB"
+
sortchar
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
self
.
process_x
+
20
,
"Res MB"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
self
.
process_x
+
30
,
"Name"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
process_x
+
10
,
"Size MB"
+
sortchar
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
process_x
+
20
,
"Res MB"
,
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
3
,
process_x
+
30
,
"Name"
,
8
)
for
processes
in
range
(
0
,
min
(
screen_y
-
self
.
term_h
+
self
.
process_y
,
len
(
processlist
))):
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
self
.
process_x
,
"%.1f"
%
processlist
[
processes
][
'cpu_percent'
],
8
,
self
.
__getColor
(
processlist
[
processes
][
'cpu_percent'
]))
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
self
.
process_x
+
10
,
str
((
processlist
[
processes
][
'proc_size'
])
/
1048576
),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
self
.
process_x
+
20
,
str
((
processlist
[
processes
][
'proc_resident'
])
/
1048576
),
8
)
maxprocessname
=
screen_x
-
self
.
process_x
-
30
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
process_x
,
"%.1f"
%
processlist
[
processes
][
'cpu_percent'
],
8
,
self
.
__getColor
(
processlist
[
processes
][
'cpu_percent'
]))
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
process_x
+
10
,
str
((
processlist
[
processes
][
'proc_size'
])
/
1048576
),
8
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
process_x
+
20
,
str
((
processlist
[
processes
][
'proc_resident'
])
/
1048576
),
8
)
maxprocessname
=
screen_x
-
process_x
-
30
# If screen space is available then display long name
if
((
len
(
processlist
[
processes
][
'proctitle'
])
>
maxprocessname
)
or
(
len
(
processlist
[
processes
][
'proctitle'
])
==
0
)):
processname
=
processlist
[
processes
][
'process_name'
]
else
:
processname
=
processlist
[
processes
][
'proctitle'
]
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
self
.
process_x
+
30
,
processname
,
maxprocessname
)
self
.
term_window
.
addnstr
(
self
.
process_y
+
4
+
processes
,
process_x
+
30
,
processname
,
maxprocessname
)
def
displayCaption
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录