Skip to content

Commit

Permalink
Change remaining fprintfs to new logger
Browse files Browse the repository at this point in the history
Signed-off-by: Łukasz Plewa <lukasz.plewa@intel.com>
  • Loading branch information
lplewa committed Jan 9, 2024
1 parent 9fe422d commit 710646e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
19 changes: 11 additions & 8 deletions source/adapters/level_zero/adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ ur_result_t adapterStateTeardown() {
//
// clang-format on

fprintf(stderr, "Check balance of create/destroy calls\n");
fprintf(stderr,
"----------------------------------------------------------\n");
logger::debug("Check balance of create/destroy calls");
logger::debug("----------------------------------------------------------");
std::stringstream ss;
for (const auto &Row : CreateDestroySet) {
int diff = 0;
for (auto I = Row.begin(); I != Row.end();) {
Expand All @@ -81,23 +81,26 @@ ur_result_t adapterStateTeardown() {
bool Last = (++I == Row.end());

if (Last) {
fprintf(stderr, " \\--->");
ss << " \\--->";
diff -= ZeCount;
} else {
diff += ZeCount;
if (!First) {
fprintf(stderr, " | \n");
ss << " | ";
logger::debug(ss.str().c_str());
ss.clear();
}
}

fprintf(stderr, "%30s = %-5d", ZeName, ZeCount);
ss << ZeName << " = " << ZeCount;
}

if (diff) {
LeakFound = true;
fprintf(stderr, " ---> LEAK = %d", diff);
ss << " ---> LEAK = " << diff;
}
fprintf(stderr, "\n");
logger::debug(ss.str().c_str());
ss.clear();
}

ZeCallCount->clear();
Expand Down
8 changes: 4 additions & 4 deletions source/adapters/level_zero/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ static auto getUrResultString = [](ur_result_t Result) {
#define UR_CALL(Call) \
{ \
if (PrintTrace) \
fprintf(stderr, "UR ---> %s\n", #Call); \
logger::debug("UR ---> {}", #Call); \
ur_result_t Result = (Call); \
if (PrintTrace) \
fprintf(stderr, "UR <--- %s(%s)\n", #Call, getUrResultString(Result)); \
logger::debug("UR <--- {}({})", #Call, getUrResultString(Result)); \
if (Result != UR_RESULT_SUCCESS) \
return Result; \
}
Expand Down Expand Up @@ -288,10 +288,10 @@ template <class T> struct ZesStruct : public T {
#define UR_CALL(Call) \
{ \
if (PrintTrace) \
fprintf(stderr, "UR ---> %s\n", #Call); \
logger::debug("UR ---> {}", #Call); \
ur_result_t Result = (Call); \
if (PrintTrace) \
fprintf(stderr, "UR <--- %s(%s)\n", #Call, getUrResultString(Result)); \
logger::debug("UR <--- {}({})", #Call, getUrResultString(Result)); \
if (Result != UR_RESULT_SUCCESS) \
return Result; \
}
Expand Down

0 comments on commit 710646e

Please sign in to comment.