Add compiled-out debugging prints
These are extremely useful to learn what exactly is happening during the
scan but are not needed for the normal operation.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: Ic260d36a8aef26377e2c361a7e87286b82d0fbfc
diff --git a/src/peci_pcie.cpp b/src/peci_pcie.cpp
index eabdf84..4bfe6b1 100644
--- a/src/peci_pcie.cpp
+++ b/src/peci_pcie.cpp
@@ -43,6 +43,8 @@
static bool abortScan;
static bool scanInProgress;
+constexpr const bool debug = false;
+
namespace function
{
static constexpr char const* functionTypeName = "FunctionType";
@@ -198,6 +200,12 @@
data.data(), // PCI Read Data
&cc); // PECI Completion Code
#endif
+ if constexpr (peci_pcie::debug)
+ {
+ std::cerr << "Request: bus " << bus << " dev " << dev << " func "
+ << func << " pciOffset " << pciOffset << " ret: " << ret
+ << " cc: " << static_cast<int>(cc) << "\n";
+ }
}
if (ret != PECI_CC_SUCCESS)
{
@@ -782,6 +790,7 @@
if (!peci_pcie::scanInProgress)
{
// get the PECI client address list
+ std::cerr << "Getting map\n";
if (getCPUBusMap(cpuInfo) != resCode::resOk)
{
peci_pcie::abortScan = true;
@@ -802,11 +811,20 @@
{
static bool lastPECIState = false;
bool peciAvailable = isPECIAvailable();
+ if constexpr (peci_pcie::debug)
+ {
+ std::cerr << "peciAvailableCheck " << peciAvailable << " "
+ << lastPECIState << " " << peci_pcie::abortScan << "\n";
+ }
if (peciAvailable && (!lastPECIState || peci_pcie::abortScan))
{
lastPECIState = true;
auto pcieTimeout = std::make_shared<boost::asio::steady_timer>(io);
constexpr const int pcieWaitTime = 60;
+ if constexpr (peci_pcie::debug)
+ {
+ std::cerr << "Scanning in 60 seconds\n";
+ }
pcieTimeout->expires_after(std::chrono::seconds(pcieWaitTime));
pcieTimeout->async_wait([&io, &objServer, &cpuInfo, pcieTimeout](
const boost::system::error_code& ec) {