Skip to content

Commit ccaf9c2

Browse files
committed
debug: convert to DBG macro in utils.*
Change-Id: I3290f1c00f6456adcdd91ac04bff340bb9e73a41
1 parent b6c127e commit ccaf9c2

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/utils.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ int calibratedSleep(const double delay, const char* sysCmd, const MainLoop& main
846846
{
847847
if (delay_ms > 0)
848848
{
849-
// std::cerr << "DEBUG: sleeping for " << std::dec << delay_ms << " ms...\n";
849+
DBG(1, "sleeping for " , std::dec , delay_ms , " ms...");
850850
MySleepMs(delay_ms);
851851
}
852852
}
@@ -1261,7 +1261,7 @@ int load_events(const std::string &fn, std::map<std::string, uint32_t> &ofm,
12611261
nameMap[h_name] = nameMap_value;
12621262
}
12631263
ctr.h_id = (uint32_t)nameMap.size() - 1;
1264-
//cout << "h_name:" << ctr.h_event_name << "h_id: "<< ctr.h_id << "\n";
1264+
DBG(2, "h_name:" , ctr.h_event_name , "h_id: ", ctr.h_id);
12651265
break;
12661266
case PCM::V_EVENT_NAME:
12671267
{
@@ -1273,7 +1273,7 @@ int load_events(const std::string &fn, std::map<std::string, uint32_t> &ofm,
12731273
if (v_nameMap.find(v_name) == v_nameMap.end())
12741274
{
12751275
v_nameMap[v_name] = (unsigned int)v_nameMap.size() - 1;
1276-
//cout << "v_name(" << v_name << ")="<< v_nameMap[v_name] << "\n";
1276+
DBG(2, "v_name(" , v_name , ")=", v_nameMap[v_name]);
12771277
}
12781278
else
12791279
{
@@ -1282,7 +1282,7 @@ int load_events(const std::string &fn, std::map<std::string, uint32_t> &ofm,
12821282
throw std::invalid_argument(err_msg);
12831283
}
12841284
ctr.v_id = (uint32_t)v_nameMap.size() - 1;
1285-
//cout << "h_name:" << ctr.h_event_name << ",hid=" << ctr.h_id << ",v_name:" << ctr.v_event_name << ",v_id: "<< ctr.v_id << "\n";
1285+
DBG(2, "h_name:" , ctr.h_event_name , ",hid=" , ctr.h_id , ",v_name:" , ctr.v_event_name , ",v_id: ", ctr.v_id);
12861286
break;
12871287
}
12881288
//TODO: double type for multiplier. drop divider variable
@@ -1307,7 +1307,7 @@ int load_events(const std::string &fn, std::map<std::string, uint32_t> &ofm,
13071307
}
13081308
}
13091309

1310-
//std::cout << "Finish parsing: " << line << "\n";
1310+
DBG(2, "Finished parsing: " , line);
13111311
if (pfn_evtcb(EVT_LINE_COMPLETE, evtcb_ctx, ctr, ofm, "", 0))
13121312
{
13131313
in.close();
@@ -1331,7 +1331,7 @@ int load_events(const std::string &fn, std::map<std::string, uint32_t> &ofm,
13311331

13321332
bool get_cpu_bus(uint32 msmDomain, uint32 msmBus, uint32 msmDev, uint32 msmFunc, uint32 &cpuBusValid, std::vector<uint32> &cpuBusNo, int &cpuPackageId)
13331333
{
1334-
//std::cout << "get_cpu_bus: d=" << std::hex << msmDomain << ",b=" << msmBus << ",d=" << msmDev << ",f=" << msmFunc << std::dec << " \n";
1334+
DBG(2, "get_cpu_bus: d=" , std::hex , msmDomain , ",b=" , msmBus , ",d=" , msmDev , ",f=" , msmFunc , std::dec );
13351335
try
13361336
{
13371337
PciHandleType h(msmDomain, msmBus, msmDev, msmFunc);
@@ -1483,7 +1483,7 @@ bool readMapFromSysFS(const char * path, std::unordered_map<std::string, uint32>
14831483
std::istringstream iss2(value);
14841484
iss2 >> std::setbase(0) >> numValue;
14851485
result.insert(std::pair<std::string, uint32>(key, numValue));
1486-
//std::cerr << "readMapFromSysFS:" << key << "=" << numValue << ".\n";
1486+
DBG(3, "readMapFromSysFS:" , key , "=" , numValue , ".");
14871487
}
14881488

14891489
fclose(f);

src/utils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <fstream>
1515
#include <time.h>
1616
#include "types.h"
17+
#include "debug.h"
1718
#include <vector>
1819
#include <list>
1920
#include <chrono>
@@ -504,7 +505,7 @@ class MainLoop
504505
void operator ()(const Body & body)
505506
{
506507
unsigned int i = 1;
507-
// std::cerr << "DEBUG: numberOfIterations: " << numberOfIterations << "\n";
508+
DBG(1, "numberOfIterations: " , numberOfIterations);
508509
while ((i <= numberOfIterations) || (numberOfIterations == 0))
509510
{
510511
if (body() == false)

0 commit comments

Comments
 (0)