Skip to content

Conversation

@cmcfarlen
Copy link
Contributor

Newer clang compilers want %lld for long long and %ld for long and will warn otherwise. Unfortunately, there isn't a way to use the PRI* macros to produce lld on 64 bit word systems.

@cmcfarlen cmcfarlen added this to the 10.2.0 milestone Nov 21, 2025
@cmcfarlen cmcfarlen requested a review from moonchen November 21, 2025 00:32
@cmcfarlen cmcfarlen self-assigned this Nov 21, 2025
Dbg(dbg_ctl_watchdog, "Starting watchdog with timeout %" PRIu64 " ms on %zu threads. sleep_time = %" PRIu64 " us",
_timeout.count(), _threads.size(), std::chrono::duration_cast<std::chrono::microseconds>(sleep_time).count());
Dbg(dbg_ctl_watchdog, "Starting watchdog with timeout %lld ms on %zu threads. sleep_time = %lld us", _timeout.count(),
_threads.size(), std::chrono::duration_cast<std::chrono::microseconds>(sleep_time).count());
Copy link
Contributor

@moonchen moonchen Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To deal with different numeric types for std::chrono::microseconds on different systems, how about:

_threads.size(), std::chrono::duration_cast<std::chrono::duration<long long, std::micro>>(sleep_time).count());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem like different vendors/versions have different types for rep. Madness!

if (warned_seq < seq) {
// Warn once per loop iteration
Warning("Watchdog: [ET_NET %zu] has been awake for %" PRIu64 " ms", i,
Warning("Watchdog: [ET_NET %zu] has been awake for %lld ms", i,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise,

std::chrono::duration_cast<std::chrono::duration<long long, std::milli>>(awake_duration).count());

@cmcfarlen cmcfarlen marked this pull request as ready for review November 24, 2025 17:55
@cmcfarlen cmcfarlen requested a review from moonchen November 25, 2025 01:37
Comment on lines 64 to 65
std::chrono::duration_cast<std::chrono::duration<long long, std::milli>>(_timeout).count(), _threads.size(),
std::chrono::duration_cast<std::chrono::duration<long long, std::micro>>(sleep_time).count());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the compilers are happy with it. Can we put this in a using alias though?

@cmcfarlen cmcfarlen requested a review from bneradt November 25, 2025 15:20
Copy link
Contributor

@bneradt bneradt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants