Skip to content

Commit

Permalink
fixed mixed output of adapter and regular traces
Browse files Browse the repository at this point in the history
Fixed #2002 issue.
Regular UR tracing prints now calls in two separate lines like PI does.
  • Loading branch information
lslusarczyk committed Sep 23, 2024
1 parent f5c907a commit 3785539
Show file tree
Hide file tree
Showing 3 changed files with 2,569 additions and 1,015 deletions.
15 changes: 10 additions & 5 deletions scripts/templates/trcddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,22 @@ namespace ur_tracing_layer
uint64_t instance = getContext()->notify_begin(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", &params);

auto &logger = getContext()->logger;
const bool should_log = (logger.getLevel() <= logger::Level::INFO);

logger.info("---> ${th.make_func_name(n, tags, obj)}");
if (should_log) {
std::ostringstream args_str_before;
ur::extras::printFunctionParams(args_str_before, ${th.make_func_etor(n, tags, obj)}, &params);
logger.info(" ---> ${th.make_func_name(n, tags, obj)}({})\n", args_str_before.str());
}

${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} );

getContext()->notify_end(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", &params, &result, instance);

if (logger.getLevel() <= logger::Level::INFO) {
std::ostringstream args_str;
ur::extras::printFunctionParams(args_str, ${th.make_func_etor(n, tags, obj)}, &params);
logger.info("({}) -> {};\n", args_str.str(), result);
if (should_log) {
std::ostringstream args_str_after;
ur::extras::printFunctionParams(args_str_after, ${th.make_func_etor(n, tags, obj)}, &params);
logger.info(" <--- ${th.make_func_name(n, tags, obj)}({}) -> {};\n", args_str_after.str(), result);
}

return result;
Expand Down
Loading

0 comments on commit 3785539

Please sign in to comment.