Skip to content

Commit b6c127e

Browse files
committed
debug: convert to DBG macro in cpucounters.h
Change-Id: Iae484fa9f3a788a6ccd82bb80920078f8145a083
1 parent 893ea28 commit b6c127e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/cpucounters.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ class MMIORegister64 : public HWRegister
158158
}
159159
void operator = (uint64 val) override
160160
{
161-
// std::cout << std::hex << "MMIORegister64 writing " << val << " at offset " << offset << std::dec << std::endl;
161+
DBG(4, std::hex , "MMIORegister64 writing " , val , " at offset " , offset , std::dec);
162162
handle->write64(offset, val);
163163
}
164164
operator uint64 () override
165165
{
166166
const uint64 val = handle->read64(offset);
167-
// std::cout << std::hex << "MMIORegister64 read " << val << " from offset " << offset << std::dec << std::endl;
167+
DBG(4, std::hex , "MMIORegister64 read " , val , " from offset " , offset , std::dec);
168168
return val;
169169
}
170170
};
@@ -181,13 +181,13 @@ class MMIORegister32 : public HWRegister
181181
}
182182
void operator = (uint64 val) override
183183
{
184-
// std::cout << std::hex << "MMIORegister32 writing " << val << " at offset " << offset << std::dec << std::endl;
184+
DBG(4, std::hex , "MMIORegister32 writing " , val , " at offset " , offset , std::dec);
185185
handle->write32(offset, (uint32)val);
186186
}
187187
operator uint64 () override
188188
{
189189
const uint64 val = (uint64)handle->read32(offset);
190-
// std::cout << std::hex << "MMIORegister32 read " << val << " from offset " << offset << std::dec << std::endl;
190+
DBG(4, std::hex , "MMIORegister32 read " , val , " from offset " , offset , std::dec);
191191
return val;
192192
}
193193
};
@@ -210,7 +210,7 @@ class MSRRegister : public HWRegister
210210
{
211211
uint64 value = 0;
212212
handle->read(offset, &value);
213-
// std::cout << "reading MSR " << offset << " returning " << value << std::endl;
213+
DBG(4, "reading MSR " , offset , " returning " , value);
214214
return value;
215215
}
216216
};
@@ -767,7 +767,7 @@ class PCM_API PCM
767767
auto& pmu = pmuIter->second[unit];
768768
for (size_t i = 0; pmu.get() != nullptr && i < pmu->size(); ++i)
769769
{
770-
// std::cerr << "s " << socket << " d " << die << " pmu " << pmu_id << " unit " << unit << " ctr " << i << "\n";
770+
DBG(4, "s " , socket , " d " , die , " pmu " , pmu_id , " unit " , unit , " ctr " , i );
771771
result.Counters[die][pmu_id][unit][i] = *(pmu->counterValue[i]);
772772
}
773773
}
@@ -3108,7 +3108,7 @@ class BasicCounterState
31083108
MemoryBWLocal += o.MemoryBWLocal;
31093109
MemoryBWTotal += o.MemoryBWTotal;
31103110
SMICount += o.SMICount;
3111-
// std::cout << "before PCM debug aggregate "<< FrontendBoundSlots << " " << BadSpeculationSlots << " " << BackendBoundSlots << " " <<RetiringSlots << std::endl;
3111+
DBG(4, "before PCM debug aggregate ", FrontendBoundSlots , " " , BadSpeculationSlots , " " , BackendBoundSlots , " " , RetiringSlots );
31123112
BasicCounterState old = *this;
31133113
FrontendBoundSlots += o.FrontendBoundSlots;
31143114
BadSpeculationSlots += o.BadSpeculationSlots;
@@ -3119,7 +3119,7 @@ class BasicCounterState
31193119
FetchLatSlots += o.FetchLatSlots;
31203120
BrMispredSlots += o.BrMispredSlots;
31213121
HeavyOpsSlots += o.HeavyOpsSlots;
3122-
//std::cout << "after PCM debug aggregate "<< FrontendBoundSlots << " " << BadSpeculationSlots << " " << BackendBoundSlots << " " <<RetiringSlots << std::endl;
3122+
DBG(4, "after PCM debug aggregate ", FrontendBoundSlots , " " , BadSpeculationSlots , " " , BackendBoundSlots , " " ,RetiringSlots);
31233123
assert(FrontendBoundSlots >= old.FrontendBoundSlots);
31243124
assert(BadSpeculationSlots >= old.BadSpeculationSlots);
31253125
assert(BackendBoundSlots >= old.BackendBoundSlots);
@@ -5144,7 +5144,7 @@ inline double getLocalMemoryRequestRatio(const CounterStateType & before, const
51445144
if (PCM::getInstance()->localMemoryRequestRatioMetricAvailable() == false) return -1.;
51455145
const auto all = after.UncHARequests - before.UncHARequests;
51465146
const auto local = after.UncHALocalRequests - before.UncHALocalRequests;
5147-
// std::cout << "PCM DEBUG "<< 64*all/1e6 << " " << 64*local/1e6 << "\n";
5147+
DBG(4, 64*all/1e6 , " " , 64*local/1e6);
51485148
return double(local)/double(all);
51495149
}
51505150

@@ -5183,8 +5183,8 @@ inline uint64 getAllSlots(const CounterStateType & before, const CounterStateTyp
51835183
const int64 b = after.FrontendBoundSlots - before.FrontendBoundSlots;
51845184
const int64 c = after.BadSpeculationSlots - before.BadSpeculationSlots;
51855185
const int64 d = after.RetiringSlots - before.RetiringSlots;
5186-
// std::cout << "before DEBUG: " << before.FrontendBoundSlots << " " << before.BadSpeculationSlots << " "<< before.BackendBoundSlots << " " << before.RetiringSlots << std::endl;
5187-
// std::cout << "after DEBUG: " << after.FrontendBoundSlots << " " << after.BadSpeculationSlots << " " << after.BackendBoundSlots << " " << after.RetiringSlots << std::endl;
5186+
DBG(4, "before: " , before.FrontendBoundSlots , " " , before.BadSpeculationSlots , " ", before.BackendBoundSlots , " " , before.RetiringSlots);
5187+
DBG(4, "afterG: " , after.FrontendBoundSlots , " " , after.BadSpeculationSlots , " " , after.BackendBoundSlots , " " , after.RetiringSlots);
51885188
assert(a >= 0);
51895189
assert(b >= 0);
51905190
assert(c >= 0);
@@ -5202,7 +5202,7 @@ inline uint64 getAllSlotsRaw(const CounterStateType& before, const CounterStateT
52025202
template <class CounterStateType>
52035203
inline double getBackendBound(const CounterStateType & before, const CounterStateType & after)
52045204
{
5205-
// std::cout << "DEBUG: "<< after.BackendBoundSlots - before.BackendBoundSlots << " " << getAllSlots(before, after) << std::endl;
5205+
DBG(4, (after.BackendBoundSlots - before.BackendBoundSlots) , " " , getAllSlots(before, after));
52065206
if (PCM::getInstance()->isHWTMAL1Supported())
52075207
return double(after.BackendBoundSlots - before.BackendBoundSlots)/double(getAllSlots(before, after));
52085208
return 0.;
@@ -5230,7 +5230,7 @@ inline double getCoreBound(const CounterStateType & before, const CounterStateTy
52305230
template <class CounterStateType>
52315231
inline double getFrontendBound(const CounterStateType & before, const CounterStateType & after)
52325232
{
5233-
// std::cout << "DEBUG: "<< after.FrontendBoundSlots - before.FrontendBoundSlots << " " << getAllSlots(before, after) << std::endl;
5233+
DBG(4, (after.FrontendBoundSlots - before.FrontendBoundSlots) , " " , getAllSlots(before, after));
52345234
if (PCM::getInstance()->isHWTMAL1Supported())
52355235
return double(after.FrontendBoundSlots - before.FrontendBoundSlots)/double(getAllSlots(before, after));
52365236
return 0.;
@@ -5258,7 +5258,7 @@ inline double getFetchBandwidthBound(const CounterStateType & before, const Coun
52585258
template <class CounterStateType>
52595259
inline double getBadSpeculation(const CounterStateType & before, const CounterStateType & after)
52605260
{
5261-
// std::cout << "DEBUG: "<< after.BadSpeculationSlots - before.BadSpeculationSlots << " " << getAllSlots(before, after) << std::endl;
5261+
DBG(4, (after.BadSpeculationSlots - before.BadSpeculationSlots) , " " , getAllSlots(before, after));
52625262
if (PCM::getInstance()->isHWTMAL1Supported())
52635263
return double(after.BadSpeculationSlots - before.BadSpeculationSlots)/double(getAllSlots(before, after));
52645264
return 0.;
@@ -5286,7 +5286,7 @@ inline double getMachineClearsBound(const CounterStateType & before, const Count
52865286
template <class CounterStateType>
52875287
inline double getRetiring(const CounterStateType & before, const CounterStateType & after)
52885288
{
5289-
// std::cout << "DEBUG: "<< after.RetiringSlots - before.RetiringSlots << " " << getAllSlots(before, after) << std::endl;
5289+
DBG(4, (after.RetiringSlots - before.RetiringSlots) , " " , getAllSlots(before, after));
52905290
if (PCM::getInstance()->isHWTMAL1Supported())
52915291
return double(after.RetiringSlots - before.RetiringSlots)/double(getAllSlots(before, after));
52925292
return 0.;

0 commit comments

Comments
 (0)