Merge pull request #62 from littlewu2508/master
uint32_t get_cpu_count() : support >255 threads
This commit is contained in:
commit
d5007d4694
@ -45,7 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
float cpu_percentage( unsigned );
|
float cpu_percentage( unsigned );
|
||||||
uint8_t get_cpu_count();
|
uint32_t get_cpu_count();
|
||||||
|
|
||||||
/** CPU percentage output mode.
|
/** CPU percentage output mode.
|
||||||
*
|
*
|
||||||
|
@ -84,8 +84,9 @@ std::string mem_string( const MemoryStatus & mem_status,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: // Default mode, just show the used/total memory in MB
|
default: // Default mode, just show the used/total memory in MB
|
||||||
oss << static_cast< unsigned int >( mem_status.used_mem ) << '/'
|
if(mem_status.used_mem>100000 && mem_status.total_mem>100000) oss<<static_cast<unsigned int>(mem_status.used_mem/1024)<<"/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB";
|
||||||
<< static_cast< unsigned int >( mem_status.total_mem ) << "MB";
|
else if(mem_status.used_mem<100000 && mem_status.total_mem>100000) oss<<static_cast<unsigned int>(mem_status.used_mem)<<"MB/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB";
|
||||||
|
else oss<<static_cast<unsigned int>(mem_status.used_mem)<<"/"<<static_cast<unsigned int>(mem_status.total_mem)<<"MB";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( use_colors )
|
if( use_colors )
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "luts.h"
|
#include "luts.h"
|
||||||
|
|
||||||
uint8_t get_cpu_count()
|
uint32_t get_cpu_count()
|
||||||
{
|
{
|
||||||
return sysconf( _SC_NPROCESSORS_ONLN );
|
return sysconf( _SC_NPROCESSORS_ONLN );
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
uint8_t get_cpu_count()
|
uint32_t get_cpu_count()
|
||||||
{
|
{
|
||||||
return sysconf( _SC_NPROCESSORS_ONLN );
|
return sysconf( _SC_NPROCESSORS_ONLN );
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@ static PDH_HCOUNTER cpuTotal;
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "luts.h"
|
#include "luts.h"
|
||||||
|
|
||||||
uint8_t get_cpu_count()
|
uint32_t get_cpu_count()
|
||||||
{
|
{
|
||||||
return static_cast< uint8_t >( std::thread::hardware_concurrency() );
|
return static_cast< uint32_t >( std::thread::hardware_concurrency() );
|
||||||
}
|
}
|
||||||
|
|
||||||
float cpu_percentage( unsigned cpu_usage_delay )
|
float cpu_percentage( unsigned cpu_usage_delay )
|
||||||
|
Loading…
Reference in New Issue
Block a user