uint32_t get_cpu_count() : support >255 threads

This commit is contained in:
WuYiyang 2020-02-23 02:40:10 +00:00
parent f96ae7a76a
commit d34821cb95
4 changed files with 5 additions and 5 deletions

@ -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.
* *

@ -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 )