Skip to content

Commit

Permalink
[UR] fix warnings in collector
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Vesely committed Sep 15, 2023
1 parent 3e1d0d8 commit e14e8bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
13 changes: 7 additions & 6 deletions examples/collector/collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ static std::unordered_map<
* On begin, it prints the function declaration with the call arguments specified,
* and on end it prints the function name with the result of the call.
*/
XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
xpti::trace_event_data_t *parent,
xpti::trace_event_data_t *event,
uint64_t instance, const void *user_data) {
XPTI_CALLBACK_API void
trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent,
[[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance,
const void *user_data) {
auto *args = static_cast<const xpti::function_with_args_t *>(user_data);
std::ostringstream out;
if (trace_type == TRACE_FN_BEGIN) {
Expand Down Expand Up @@ -120,7 +120,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
*/
XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
unsigned int minor_version,
const char *version_str,
[[maybe_unused]] const char *version_str,
const char *stream_name) {
if (stream_name == nullptr) {
std::cout << "Stream name not provided. Aborting." << std::endl;
Expand Down Expand Up @@ -158,5 +158,6 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
*
* Can be used to cleanup state or resources.
*/
XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) { /* noop */
XPTI_CALLBACK_API void
xptiTraceFinish([[maybe_unused]] const char *stream_name) { /* noop */
}
18 changes: 10 additions & 8 deletions tools/urtrace/collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,12 @@ class JsonWriter : public TraceWriter {
"\"tid\": \"\", \"ts\": \"\"}}");
out.info("]\n}}");
}
void begin(uint64_t id, const char *fname, std::string args) override {}
void begin([[maybe_unused]] uint64_t id, [[maybe_unused]] const char *fname,
[[maybe_unused]] std::string args) override {}

void end(uint64_t id, const char *fname, std::string args, Timepoint tp,
Timepoint start_tp, const ur_result_t *resultp) override {
void end([[maybe_unused]] uint64_t id, const char *fname, std::string args,
Timepoint tp, Timepoint start_tp,
[[maybe_unused]] const ur_result_t *resultp) override {
auto dur = tp - start_tp;
auto ts_us = std::chrono::duration_cast<std::chrono::microseconds>(
tp.time_since_epoch())
Expand Down Expand Up @@ -314,10 +316,10 @@ std::optional<fn_context> pop_instance_data(uint64_t instance) {
return data;
}

XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
xpti::trace_event_data_t *parent,
xpti::trace_event_data_t *event,
uint64_t instance, const void *user_data) {
XPTI_CALLBACK_API void
trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent,
[[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance,
const void *user_data) {
// stop the the clock as the very first thing, only used for TRACE_FN_END
auto time_for_end = Clock::now();
auto *args = static_cast<const xpti::function_with_args_t *>(user_data);
Expand Down Expand Up @@ -367,7 +369,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
*/
XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
unsigned int minor_version,
const char *version_str,
[[maybe_unused]] const char *version_str,
const char *stream_name) {
if (stream_name == nullptr) {
out.debug("Found stream with null name. Skipping...");
Expand Down

0 comments on commit e14e8bc

Please sign in to comment.