Print CPU usage without decimal point if >= 100
Also: add --colours shortopt to help/readme, Conform to coding style.
This commit is contained in:
parent
4a2c4efb9a
commit
b7d2d2a73e
@ -116,7 +116,7 @@ The full usage::
|
|||||||
Available options:
|
Available options:
|
||||||
-h, --help
|
-h, --help
|
||||||
Prints this help message
|
Prints this help message
|
||||||
--colors
|
-c, --colors
|
||||||
Use tmux colors in output
|
Use tmux colors in output
|
||||||
--powerline-right
|
--powerline-right
|
||||||
Use powerline symbols throughout the output, DO NOT reset background color at the end, enables --colors
|
Use powerline symbols throughout the output, DO NOT reset background color at the end, enables --colors
|
||||||
|
@ -51,10 +51,17 @@ std::string cpu_string( CPU_MODE cpu_mode, unsigned int cpu_usage_delay, unsigne
|
|||||||
percentage = cpu_percentage( cpu_usage_delay );
|
percentage = cpu_percentage( cpu_usage_delay );
|
||||||
|
|
||||||
// set multiplier to number of threads ?
|
// set multiplier to number of threads ?
|
||||||
if ( cpu_mode == CPU_MODE_THREADS ) {
|
if ( cpu_mode == CPU_MODE_THREADS )
|
||||||
|
{
|
||||||
multiplier = get_cpu_count();
|
multiplier = get_cpu_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if percentage*multiplier >= 100, remove decimal point to keep number short
|
||||||
|
if ( percentage*multiplier >= 100.0f )
|
||||||
|
{
|
||||||
|
oss.precision( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
if( use_colors )
|
if( use_colors )
|
||||||
{
|
{
|
||||||
unsigned int percent = static_cast<unsigned int>( percentage );
|
unsigned int percent = static_cast<unsigned int>( percentage );
|
||||||
|
Loading…
Reference in New Issue
Block a user