Skip to content

Commit abafc63

Browse files
committed
refactor
1 parent 18dbecd commit abafc63

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/daemon/daemon.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,9 @@ namespace PCMDaemon {
563563
for(uint32 channel(0); channel < MEMORY_MAX_IMC_CHANNELS; ++channel)
564564
{
565565
//In case of JKT-EN, there are only three channels. Skip one and continue.
566-
bool memoryReadAvailable = getMCCounter(channel,MEMORY_READ,serverUncoreCounterStatesBefore_[skt],serverUncoreCounterStatesAfter_[skt]) == 0.0;
567-
bool memoryWriteAvailable = getMCCounter(channel,MEMORY_WRITE,serverUncoreCounterStatesBefore_[skt],serverUncoreCounterStatesAfter_[skt]) == 0.0;
568-
if(memoryReadAvailable && memoryWriteAvailable)
566+
const bool memoryReadNotAvailable = getMCCounter(channel,MEMORY_READ,serverUncoreCounterStatesBefore_[skt],serverUncoreCounterStatesAfter_[skt]) == 0;
567+
const bool memoryWriteNotAvailable = getMCCounter(channel,MEMORY_WRITE,serverUncoreCounterStatesBefore_[skt],serverUncoreCounterStatesAfter_[skt]) == 0;
568+
if (memoryReadNotAvailable && memoryWriteNotAvailable)
569569
{
570570
iMC_Rd_socket_chan[skt][channel] = -1.0;
571571
iMC_Wr_socket_chan[skt][channel] = -1.0;
@@ -593,11 +593,11 @@ namespace PCMDaemon {
593593
for(uint64 channel(0); channel < MEMORY_MAX_IMC_CHANNELS; ++channel)
594594
{
595595
//If the channel read neg. value, the channel is not working; skip it.
596-
if(iMC_Rd_socket_chan[0][skt*MEMORY_MAX_IMC_CHANNELS+channel] < 0.0 && iMC_Wr_socket_chan[0][skt*MEMORY_MAX_IMC_CHANNELS+channel] < 0.0)
596+
if(iMC_Rd_socket_chan[skt][channel] < 0.0 && iMC_Wr_socket_chan[skt][channel] < 0.0)
597597
continue;
598598

599-
float socketChannelRead = iMC_Rd_socket_chan[0][skt*MEMORY_MAX_IMC_CHANNELS+channel];
600-
float socketChannelWrite = iMC_Wr_socket_chan[0][skt*MEMORY_MAX_IMC_CHANNELS+channel];
599+
const float socketChannelRead = iMC_Rd_socket_chan[skt][channel];
600+
const float socketChannelWrite = iMC_Wr_socket_chan[skt][channel];
601601

602602
memory.sockets[onlineSocketsI].channels[currentChannelI].read = socketChannelRead;
603603
memory.sockets[onlineSocketsI].channels[currentChannelI].write = socketChannelWrite;
@@ -611,7 +611,7 @@ namespace PCMDaemon {
611611
memory.sockets[onlineSocketsI].read = iMC_Rd_socket[skt];
612612
memory.sockets[onlineSocketsI].write = iMC_Wr_socket[skt];
613613
memory.sockets[onlineSocketsI].total= iMC_Rd_socket[skt] + iMC_Wr_socket[skt];
614-
if(memory.dramEnergyMetricsAvailable)
614+
if (memory.dramEnergyMetricsAvailable)
615615
{
616616
memory.sockets[onlineSocketsI].dramEnergy = getDRAMConsumedJoules(socketStatesBefore_[skt], socketStatesAfter_[skt]);
617617
}
@@ -731,5 +731,4 @@ namespace PCMDaemon {
731731
}
732732
}
733733
}
734-
735734
}

0 commit comments

Comments
 (0)