diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | autom4te.cache/output.0 | 20 | ||||
-rw-r--r-- | autom4te.cache/output.1 | 20 | ||||
-rw-r--r-- | autom4te.cache/traces.1 | 2 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rwxr-xr-x | src/glances.py | 18 |
7 files changed, 49 insertions, 36 deletions
@@ -0,0 +1,4 @@ +Version 1.1 +=========== + + * Check if mem.total = 0 before division (Bug #1) @@ -0,0 +1 @@ +- Add color indicators in the last line (right) diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index bbd2b19d..392aeb1b 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -1,6 +1,6 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.68 for Glances 0.1. +@%:@ Generated by GNU Autoconf 2.68 for Glances 1.0. @%:@ @%:@ @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Glances' PACKAGE_TARNAME='glances' -PACKAGE_VERSION='0.1' -PACKAGE_STRING='Glances 0.1' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='Glances 1.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1185,7 +1185,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Glances 0.1 to adapt to many kinds of systems. +\`configure' configures Glances 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1251,7 +1251,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Glances 0.1:";; + short | recursive ) echo "Configuration of Glances 1.0:";; esac cat <<\_ACEOF @@ -1325,7 +1325,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Glances configure 0.1 +Glances configure 1.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1342,7 +1342,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Glances $as_me 0.1, which was +It was created by Glances $as_me 1.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2163,7 +2163,7 @@ fi # Define the identity of the package. PACKAGE='glances' - VERSION='0.1' + VERSION='1.0' cat >>confdefs.h <<_ACEOF @@ -2970,7 +2970,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Glances $as_me 0.1, which was +This file was extended by Glances $as_me 1.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3032,7 +3032,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Glances config.status 0.1 +Glances config.status 1.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/autom4te.cache/output.1 b/autom4te.cache/output.1 index bbd2b19d..392aeb1b 100644 --- a/autom4te.cache/output.1 +++ b/autom4te.cache/output.1 @@ -1,6 +1,6 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.68 for Glances 0.1. +@%:@ Generated by GNU Autoconf 2.68 for Glances 1.0. @%:@ @%:@ @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Glances' PACKAGE_TARNAME='glances' -PACKAGE_VERSION='0.1' -PACKAGE_STRING='Glances 0.1' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='Glances 1.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1185,7 +1185,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Glances 0.1 to adapt to many kinds of systems. +\`configure' configures Glances 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1251,7 +1251,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Glances 0.1:";; + short | recursive ) echo "Configuration of Glances 1.0:";; esac cat <<\_ACEOF @@ -1325,7 +1325,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Glances configure 0.1 +Glances configure 1.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1342,7 +1342,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Glances $as_me 0.1, which was +It was created by Glances $as_me 1.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2163,7 +2163,7 @@ fi # Define the identity of the package. PACKAGE='glances' - VERSION='0.1' + VERSION='1.0' cat >>confdefs.h <<_ACEOF @@ -2970,7 +2970,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Glances $as_me 0.1, which was +This file was extended by Glances $as_me 1.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3032,7 +3032,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Glances config.status 0.1 +Glances config.status 1.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/autom4te.cache/traces.1 b/autom4te.cache/traces.1 index 784152be..9834ce08 100644 --- a/autom4te.cache/traces.1 +++ b/autom4te.cache/traces.1 @@ -1,4 +1,4 @@ -m4trace:configure.ac:4: -1- AC_INIT([Glances], [0.1], [], [glances]) +m4trace:configure.ac:4: -1- AC_INIT([Glances], [1.0], [], [glances]) m4trace:configure.ac:4: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.ac:4: -1- m4_pattern_forbid([_AC_]) m4trace:configure.ac:4: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for Glances 0.1. +# Generated by GNU Autoconf 2.68 for Glances 1.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Glances' PACKAGE_TARNAME='glances' -PACKAGE_VERSION='0.1' -PACKAGE_STRING='Glances 0.1' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='Glances 1.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1185,7 +1185,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Glances 0.1 to adapt to many kinds of systems. +\`configure' configures Glances 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1251,7 +1251,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Glances 0.1:";; + short | recursive ) echo "Configuration of Glances 1.0:";; esac cat <<\_ACEOF @@ -1325,7 +1325,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Glances configure 0.1 +Glances configure 1.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1342,7 +1342,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Glances $as_me 0.1, which was +It was created by Glances $as_me 1.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2163,7 +2163,7 @@ fi # Define the identity of the package. PACKAGE='glances' - VERSION='0.1' + VERSION='1.0' cat >>confdefs.h <<_ACEOF @@ -2970,7 +2970,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Glances $as_me 0.1, which was +This file was extended by Glances $as_me 1.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3032,7 +3032,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Glances config.status 0.1 +Glances config.status 1.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/src/glances.py b/src/glances.py index bdd98e51..f593e3e7 100755 --- a/src/glances.py +++ b/src/glances.py @@ -33,7 +33,7 @@ import statgrab #================== # The glances version id -__version__ = "1.0" +__version__ = "1.1" # Class #====== @@ -124,10 +124,10 @@ class glancesStats(): if sortedby == 'auto': # If global Mem > 70% sort by process size # Else sort by cpu comsoption - if ( ( (self.mem['used'] - self.mem['cache']) * 100 / self.mem['total']) > 70): - sortedby = 'proc_size' - else: - sortedby = 'cpu_percent' + sortedby = 'cpu_percent' + if ( self.mem['total'] != 0): + if ( ( (self.mem['used'] - self.mem['cache']) * 100 / self.mem['total']) > 70): + sortedby = 'proc_size' return sorted(self.process, key=lambda process: process[sortedby], reverse=True) @@ -183,6 +183,7 @@ class glancesScreen(): # Text colors/styles self.title_color = curses.A_BOLD|curses.A_UNDERLINE + self.no_color = curses.color_pair(1) self.default_color = curses.color_pair(3)|curses.A_BOLD self.if50pc_color = curses.color_pair(4)|curses.A_BOLD self.if70pc_color = curses.color_pair(5)|curses.A_BOLD @@ -212,7 +213,14 @@ class glancesScreen(): # If current > 70% of max then color = self.if70pc_color / A_BOLD # If current > 90% of max then color = self.if90pc_color / A_REVERSE # By default: color = self.default_color / 0 + max = 0 + try: + (current * 100) / max + except ZeroDivisionError: + return self.no_color + variable = (current * 100) / max + if variable > 90: if self.hascolors: return self.if90pc_color |