moonchen commented on code in PR #12684:
URL: https://github.com/apache/trafficserver/pull/12684#discussion_r2550872443
##########
src/iocore/eventsystem/Watchdog.cc:
##########
@@ -60,8 +60,8 @@ Monitor::monitor_loop() const
// Divide by a floating point 2 to avoid truncation to zero.
auto sleep_time = _timeout / 2.0;
ink_release_assert(sleep_time.count() > 0);
- 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());
Review Comment:
To deal with different types for count() on different systems, how about:
```
_threads.size(), std::chrono::duration_cast<std::chrono::duration<long long,
std::micro>>(sleep_time).count());
```
##########
src/iocore/eventsystem/Watchdog.cc:
##########
@@ -90,7 +90,7 @@ Monitor::monitor_loop() const
uint64_t warned_seq =
t->heartbeat_state.warned_seq.load(std::memory_order_relaxed);
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,
Review Comment:
Likewise,
```
std::chrono::duration_cast<std::chrono::duration<long long,
std::milli>>(awake_duration).count());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]