mirror of
https://github.com/nicolargo/glances.git
synced 2024-09-21 09:37:20 +03:00
Merge pull request #46 from asergi/experimental
Thanks for your contrib !
This commit is contained in:
commit
29640ac28a
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,6 +1,8 @@
|
||||
*.pyc
|
||||
# python packaging artifacts
|
||||
*.egg-info
|
||||
/build/
|
||||
/dist/
|
||||
*~
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
|
@ -518,7 +518,7 @@ class glancesStats():
|
||||
self.network.append(netstat)
|
||||
self.network_old = self.network_new
|
||||
|
||||
# DISK IO
|
||||
# DISK I/O
|
||||
self.diskio = []
|
||||
try:
|
||||
self.diskio_old
|
||||
@ -672,7 +672,7 @@ class glancesStats():
|
||||
sortedby = 'proc_size'
|
||||
# Auto selection
|
||||
# If global Mem > 70% sort by process size
|
||||
# Else sort by cpu comsoption
|
||||
# Else sort by CPU comsoption
|
||||
try:
|
||||
memtotal = (self.mem['used'] - self.mem['cache']) * \
|
||||
100 / self.mem['total']
|
||||
@ -696,8 +696,8 @@ class glancesScreen():
|
||||
This class manage the screen (display and key pressed)
|
||||
"""
|
||||
|
||||
# By default the process list is automaticaly sorted
|
||||
# If global CPU > WANRING => Sorted by process Cpu consomption
|
||||
# By default the process list is automatically sorted
|
||||
# If global CPU > WANRING => Sorted by process CPU consomption
|
||||
# If global used MEM > WARINING => Sorted by process size
|
||||
__process_sortedby = 'auto'
|
||||
|
||||
@ -944,13 +944,13 @@ class glancesScreen():
|
||||
# 'ESC'|'q' > Exit
|
||||
end()
|
||||
elif (self.pressedkey == 97):
|
||||
# 'a' > Sort process list automaticaly
|
||||
# 'a' > Sort process list automatically
|
||||
self.setProcessSortedBy('auto')
|
||||
elif ((self.pressedkey == 99) and psutil_get_cpu_percent_tag):
|
||||
# 'c' > Sort process list by Cpu usage
|
||||
# 'c' > Sort process list by CPU usage
|
||||
self.setProcessSortedBy('cpu_percent')
|
||||
elif ((self.pressedkey == 100) and psutil_disk_io_tag):
|
||||
# 'n' > Enable/Disable diskio stats
|
||||
# 'n' > Enable/Disable disk I/O stats
|
||||
self.diskio_tag = not self.diskio_tag
|
||||
elif ((self.pressedkey == 102) and psutil_fs_usage_tag):
|
||||
# 'n' > Enable/Disable fs stats
|
||||
@ -1064,7 +1064,7 @@ class glancesScreen():
|
||||
screen_y = self.screen.getmaxyx()[0]
|
||||
if ((screen_y > self.cpu_y + 5)
|
||||
and (screen_x > self.cpu_x + 18)):
|
||||
self.term_window.addnstr(self.cpu_y, self.cpu_x, _("Cpu"), 8, \
|
||||
self.term_window.addnstr(self.cpu_y, self.cpu_x, _("CPU"), 8, \
|
||||
self.title_color if self.hascolors else curses.A_UNDERLINE)
|
||||
|
||||
if (not cpu):
|
||||
@ -1385,7 +1385,7 @@ class glancesScreen():
|
||||
and (screen_x > process_x + 49)):
|
||||
# Processes detail
|
||||
self.term_window.addnstr(self.process_y + 3, process_x, \
|
||||
_("Cpu %"), 5, \
|
||||
_("CPU %"), 5, \
|
||||
curses.A_UNDERLINE \
|
||||
if (self.getProcessSortedBy() == 'cpu_percent') else 0)
|
||||
self.term_window.addnstr(self.process_y + 3, process_x + 7, \
|
||||
@ -1481,48 +1481,40 @@ class glancesScreen():
|
||||
_("Key") + "\t" + _("Function"), 79, \
|
||||
self.title_color if self.hascolors else 0)
|
||||
self.term_window.addnstr(self.help_y + 7, self.help_x, \
|
||||
_("a") + "\t" + _("Sort process list automaticaly \
|
||||
(need PsUtil v0.2.0 or higher)"), \
|
||||
79, \
|
||||
self.ifCRITICAL_color2 \
|
||||
_("a") + "\t" + _("Sort process list automatically " \
|
||||
"(need PsUtil v0.2.0 or higher)"), \
|
||||
79, self.ifCRITICAL_color2 \
|
||||
if not psutil_get_cpu_percent_tag else 0)
|
||||
self.term_window.addnstr(self.help_y + 8, self.help_x, \
|
||||
_("c") + "\t" + _("Sort process list by CPU usage \
|
||||
(need PsUtil v0.2.0 or higher)"), \
|
||||
79, \
|
||||
self.ifCRITICAL_color2 \
|
||||
_("c") + "\t" + _("Sort process list by CPU usage " \
|
||||
"(need PsUtil v0.2.0 or higher)"), \
|
||||
79, self.ifCRITICAL_color2 \
|
||||
if not psutil_get_cpu_percent_tag else 0)
|
||||
self.term_window.addnstr(self.help_y + 9, self.help_x, \
|
||||
_("m") + "\t" + \
|
||||
_("Sort process list by virtual memory usage"), \
|
||||
79)
|
||||
_("Sort process list by virtual memory usage"), 79)
|
||||
self.term_window.addnstr(self.help_y + 10, self.help_x, \
|
||||
_("p") + "\t" + _("Sort process list by name"), 79)
|
||||
self.term_window.addnstr(self.help_y + 11, self.help_x, \
|
||||
_("d") + "\t" + _("Enable/Disable disk IO stats \
|
||||
(need PsUtil v0.4.0 or higher)"), \
|
||||
79, \
|
||||
self.ifCRITICAL_color2 if not psutil_disk_io_tag else 0)
|
||||
_("d") + "\t" + _("Enable/Disable disk I/O stats " \
|
||||
"(need PsUtil v0.4.0 or higher)"), \
|
||||
79, self.ifCRITICAL_color2 if not psutil_disk_io_tag else 0)
|
||||
self.term_window.addnstr(self.help_y + 12, self.help_x, \
|
||||
_("f") + "\t" + _("Enable/Disable file system stats \
|
||||
(need PsUtil v0.3.0 or higher)"), \
|
||||
79, \
|
||||
self.ifCRITICAL_color2 if not psutil_fs_usage_tag else 0)
|
||||
_("f") + "\t" + _("Enable/Disable file system stats " \
|
||||
"(need PsUtil v0.3.0 or higher)"), \
|
||||
79, self.ifCRITICAL_color2 if not psutil_fs_usage_tag else 0)
|
||||
self.term_window.addnstr(self.help_y + 13, self.help_x, \
|
||||
_("n") + "\t" + _("Enable/Disable network stats \
|
||||
(need PsUtil v0.3.0 or higher)"), \
|
||||
79, \
|
||||
self.ifCRITICAL_color2 if not psutil_network_io_tag else 0)
|
||||
_("n") + "\t" + _("Enable/Disable network stats " \
|
||||
"(need PsUtil v0.3.0 or higher)"), \
|
||||
79, self.ifCRITICAL_color2 if not psutil_network_io_tag else 0)
|
||||
self.term_window.addnstr(self.help_y + 14, self.help_x, \
|
||||
_("l") + "\t" + _("Enable/Disable log list \
|
||||
(only available if display > 24 lines)"), \
|
||||
79)
|
||||
_("l") + "\t" + _("Enable/Disable log list " \
|
||||
"(only available if display > 24 lines)"), 79)
|
||||
self.term_window.addnstr(self.help_y + 15, self.help_x, \
|
||||
_("h") + "\t" + _("Display/Hide help message"), 79)
|
||||
self.term_window.addnstr(self.help_y + 16, self.help_x, \
|
||||
_("q") + "\t" + \
|
||||
_("Exit from Glances (ESC key and CRTL-C also work...)"), \
|
||||
79)
|
||||
_("Exit from Glances (ESC key and CRTL-C also work)"), 79)
|
||||
|
||||
def displayNow(self, now):
|
||||
# Display the current date and time (now...) - Center
|
||||
@ -1717,20 +1709,20 @@ def printVersion():
|
||||
|
||||
def printSyntax():
|
||||
printVersion()
|
||||
print _("Usage: glances.py [-f file] [-o output] [-t sec] [-h] [-v]")
|
||||
print _("Usage: glances [-f file] [-o output] [-t sec] [-h] [-v]")
|
||||
print ""
|
||||
print _("\t-f file:\t\tSet the output folder (HTML) or file (CSV)")
|
||||
print _("\t-h:\t\tDisplay the syntax and exit")
|
||||
print _("\t-o output:\tGenerate output (available: HTML, CSV)")
|
||||
print _("\t-t sec:\t\tSet the refresh time in second default is %d" \
|
||||
print _("\t-f file\t\tSet the output folder (HTML) or file (CSV)")
|
||||
print _("\t-h\t\tDisplay the syntax and exit")
|
||||
print _("\t-o output\tGenerate output (available: HTML, CSV)")
|
||||
print _("\t-t sec\t\tSet the refresh time in second default is %d" \
|
||||
% refresh_time)
|
||||
print _("\t-v:\t\tDisplay the version and exit")
|
||||
print _("\t-v\t\tDisplay the version and exit")
|
||||
print ""
|
||||
print _("When Glances is running, you can press:")
|
||||
print _("'a' to set the automatic mode. \
|
||||
The processes are sorted automatically")
|
||||
print _("'a' to set the automatic mode. " \
|
||||
"The processes are sorted automatically")
|
||||
print _("'c' to sort the processes list by CPU consumption")
|
||||
print _("'d' to disable or enable the disk IO stats")
|
||||
print _("'d' to disable or enable the disk I/O stats")
|
||||
print _("'f' to disable or enable the file system stats")
|
||||
print _("'h' to hide or show the help message")
|
||||
print _("'l' to hide or show the logs messages")
|
||||
@ -1802,16 +1794,16 @@ def init():
|
||||
try:
|
||||
output_folder
|
||||
except UnboundLocalError:
|
||||
print _("Error: HTML export (-o html) need \
|
||||
output folder definition (-f <folder>)")
|
||||
print _("Error: HTML export (-o html) need " \
|
||||
"output folder definition (-f <folder>)")
|
||||
sys.exit(2)
|
||||
|
||||
if (csv_tag):
|
||||
try:
|
||||
output_file
|
||||
except UnboundLocalError:
|
||||
print _("Error: CSV export (-o csv) need \
|
||||
output file definition (-f <file>)")
|
||||
print _("Error: CSV export (-o csv) need " \
|
||||
"output file definition (-f <file>)")
|
||||
sys.exit(2)
|
||||
|
||||
# Catch CTRL-C
|
||||
|
Loading…
Reference in New Issue
Block a user