Bug fix. When GetNumCores failed it will return -1, which is a huge number if cast to unsigned int.
Review URL: http://webrtc-codereview.appspot.com/116005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@371 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
56294c61c9
commit
3d48d5b107
@ -17,22 +17,29 @@
|
||||
|
||||
namespace webrtc {
|
||||
CpuLinux::CpuLinux()
|
||||
{
|
||||
m_oldBusyTime = 0;
|
||||
m_oldIdleTime = 0;
|
||||
m_numCores = 0;
|
||||
m_numCores = GetNumCores();
|
||||
m_oldBusyTimeMulti = new long long[m_numCores];
|
||||
memset(m_oldBusyTimeMulti, 0, sizeof(long long) * m_numCores);
|
||||
m_oldIdleTimeMulti = new long long[m_numCores];
|
||||
memset(m_oldIdleTimeMulti, 0, sizeof(long long) * m_numCores);
|
||||
m_idleArray = new long long[m_numCores];
|
||||
memset(m_idleArray, 0, sizeof(long long) * m_numCores);
|
||||
m_busyArray = new long long[m_numCores];
|
||||
memset(m_busyArray, 0, sizeof(long long) * m_numCores);
|
||||
m_resultArray = new WebRtc_UWord32[m_numCores];
|
||||
: m_oldBusyTime(0),
|
||||
m_oldIdleTime(0),
|
||||
m_oldBusyTimeMulti(NULL),
|
||||
m_oldIdleTimeMulti(NULL),
|
||||
m_idleArray(NULL),
|
||||
m_busyArray(NULL),
|
||||
m_resultArray(NULL),
|
||||
m_numCores(0) {
|
||||
const int result = GetNumCores();
|
||||
if (result != -1) {
|
||||
m_numCores = result;
|
||||
m_oldBusyTimeMulti = new long long[m_numCores];
|
||||
memset(m_oldBusyTimeMulti, 0, sizeof(long long) * m_numCores);
|
||||
m_oldIdleTimeMulti = new long long[m_numCores];
|
||||
memset(m_oldIdleTimeMulti, 0, sizeof(long long) * m_numCores);
|
||||
m_idleArray = new long long[m_numCores];
|
||||
memset(m_idleArray, 0, sizeof(long long) * m_numCores);
|
||||
m_busyArray = new long long[m_numCores];
|
||||
memset(m_busyArray, 0, sizeof(long long) * m_numCores);
|
||||
m_resultArray = new WebRtc_UWord32[m_numCores];
|
||||
|
||||
GetData(m_oldBusyTime, m_oldIdleTime, m_busyArray, m_idleArray);
|
||||
GetData(m_oldBusyTime, m_oldIdleTime, m_busyArray, m_idleArray);
|
||||
}
|
||||
}
|
||||
|
||||
CpuLinux::~CpuLinux()
|
||||
|
Loading…
x
Reference in New Issue
Block a user