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
|
||||
|
||||
float cpu_percentage( unsigned );
|
||||
uint8_t get_cpu_count();
|
||||
uint32_t get_cpu_count();
|
||||
|
||||
/** CPU percentage output mode.
|
||||
*
|
||||
|
@ -84,8 +84,9 @@ std::string mem_string( const MemoryStatus & mem_status,
|
||||
break;
|
||||
}
|
||||
default: // Default mode, just show the used/total memory in MB
|
||||
oss << static_cast< unsigned int >( mem_status.used_mem ) << '/'
|
||||
<< static_cast< unsigned int >( mem_status.total_mem ) << "MB";
|
||||
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";
|
||||
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 )
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "cpu.h"
|
||||
#include "luts.h"
|
||||
|
||||
uint8_t get_cpu_count()
|
||||
uint32_t get_cpu_count()
|
||||
{
|
||||
return sysconf( _SC_NPROCESSORS_ONLN );
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
uint8_t get_cpu_count()
|
||||
uint32_t get_cpu_count()
|
||||
{
|
||||
return sysconf( _SC_NPROCESSORS_ONLN );
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ static PDH_HCOUNTER cpuTotal;
|
||||
#include "cpu.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 )
|
||||
|
Loading…
Reference in New Issue
Block a user