Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Commit

Permalink
fixup: fix nits and timer handling
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlau committed May 10, 2017
1 parent d9a350a commit 218cc99
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,18 +613,23 @@ static void walkHandle(uv_handle_t* h, void* arg) {
break;
}
case UV_TIMER: {
type = "timer";
data << "repeat: " << uv_timer_get_repeat(&(handle->timer));
// TODO timeout is not actually public however it is present in
// all current versions of libuv. Once uv_timer_get_timeout is
// TODO timeout/due is not actually public however it is present
// in all current versions of libuv. Once uv_timer_get_timeout is
// in a supported level of libuv we should test for it with dlsym
// and use it instead, in case timeout moves in the future.
data << ", timeout in: "
#ifdef _WIN32
<< (handle->timer.due - uv_now(handle->timer.loop)) << " ms";
uint64_t due = handle->timer.due;
#else
<< (handle->timer.timeout - uv_now(handle->timer.loop)) << " ms";
uint64_t due = handle->timer.timeout;
#endif
uint64_t now = uv_now(handle->timer.loop);
type = "timer";
data << "repeat: " << uv_timer_get_repeat(&(handle->timer));
if (due > now) {
data << ", timeout in: " << (due - now) << " ms";
} else {
data << ", timeout expired: " << (now - due) << " ms ago";
}
break;
}
case UV_TTY: {
Expand Down Expand Up @@ -701,7 +706,7 @@ static void walkHandle(uv_handle_t* h, void* arg) {

if (h->type == UV_TCP || h->type == UV_NAMED_PIPE || h->type == UV_TTY) {

data << ", write queue size "
data << ", write queue size: "
<< handle->stream.write_queue_size;
data << (uv_is_readable(&handle->stream) ? ", readable" : "")
<< (uv_is_writable(&handle->stream) ? ", writable": "");
Expand Down

0 comments on commit 218cc99

Please sign in to comment.